Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from pytorch3d import _C problem - libcudart.so.10.1 cannot open shared object file #688

Closed
kfiros1 opened this issue May 27, 2021 · 8 comments
Assignees
Labels
installation Installation questions or issues

Comments

@kfiros1
Copy link

kfiros1 commented May 27, 2021

Hi,

I've installed pytorch3D with the following command:

pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py36_cu102_pyt181/download.html

I have Cuda 10.2 and pytorch version '1.8.1+cu102'

I have problem when I import:

from pytorch3d.io import load_obj

I get the error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-5-0bda39278c2d> in <module>
----> 1 from pytorch3d.io import load_obj

~/code/core/venv/lib/python3.6/site-packages/pytorch3d/io/__init__.py in <module>
      2 
      3 
----> 4 from .obj_io import load_obj, load_objs_as_meshes, save_obj
      5 from .ply_io import load_ply, save_ply
      6 

~/code/core/venv/lib/python3.6/site-packages/pytorch3d/io/obj_io.py in <module>
     12 from pytorch3d.io.mtl_io import load_mtl, make_mesh_texture_atlas
     13 from pytorch3d.io.utils import _check_faces_indices, _make_tensor, _open_file
---> 14 from pytorch3d.renderer import TexturesAtlas, TexturesUV
     15 from pytorch3d.structures import Meshes, join_meshes_as_batch
     16 

~/code/core/venv/lib/python3.6/site-packages/pytorch3d/renderer/__init__.py in <module>
      1 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
      2 
----> 3 from .blending import (
      4     BlendParams,
      5     hard_rgb_blend,

~/code/core/venv/lib/python3.6/site-packages/pytorch3d/renderer/blending.py in <module>
      7 
      8 # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`.
----> 9 from pytorch3d import _C
     10 
     11 

ImportError: libcudart.so.10.1: cannot open shared object file: No such file or directory

It seems that it's looking for libcudart.so.10.1, However, I installed it as 10.2
What might be the problem?

@bottler
Copy link
Contributor

bottler commented May 27, 2021

I think you have files from another PyTorch3D installation somewhere, built with 10.1, which are being found. Could they be in the global python search tree, for example?
Is venv a virtual environment? It may be easier to keep your environments isolated if you can use conda rather than plan virtual environments. What happens if you start python while not in a virtual environment and then run import pytorch3d?

@nikhilaravi nikhilaravi added the installation Installation questions or issues label May 27, 2021
@kfiros1
Copy link
Author

kfiros1 commented May 28, 2021

@bottler

Yes, I'm using virtual environment.
When I start python outside the virtual environment and then command import pytorch3d
it doesnt know it: ImportError: No module named pytorch3d

By the way, import pytorch3d works fine in the virtual environment but from pytorch3d.io import load_obj does not.
I'm using linux - ubuntu 18.04

I thought that virtual environment keeps it isolated, doesn't it?
All my packages already in the virtual environment so it wouldn't be easy to transfer all to conda
but if you think that it's the solution, I'll try it.
Anyway, If you have a solution that allows using virtual environment, so please let me know.

Thanks for the reply

@bottler
Copy link
Contributor

bottler commented May 28, 2021

I haven't used virtual environments for a long time. But this seems to be a library isolation issue where a pytorch3d library build from a different installation has been found. This is the kind of thing conda environments are good at getting right.

Can you paste pip list too?

@kfiros1
Copy link
Author

kfiros1 commented May 28, 2021

absl-py                 0.9.0
anykeystore             0.2
apex                    0.1
appdirs                 1.4.4
argon2-cffi             20.1.0
astor                   0.8.1
attrs                   19.3.0
backcall                0.2.0
bleach                  3.1.5
cachetools              4.2.2
cairocffi               1.2.0
CairoSVG                2.5.1
certifi                 2020.6.20
cffi                    1.14.2
chardet                 3.0.4
colorama                0.4.3
colorlog                4.2.1
colormap                1.0.3
cryptacular             1.5.5
cssselect2              0.4.1
cycler                  0.10.0
dataclasses             0.8
decorator               4.4.2
defusedxml              0.6.0
dlib                    19.22.0
easydev                 0.9.38
easydict                1.9
entrypoints             0.3
face-alignment          1.1.0
facenet-pytorch         2.5.2
future                  0.18.2
fvcore                  0.1.5.post20210410
gast                    0.4.0
google-auth             1.30.0
google-auth-oauthlib    0.4.4
google-pasta            0.2.0
grpcio                  1.31.0
h5py                    2.10.0
hupper                  1.10.2
idna                    2.8
imageio                 2.9.0
importlib-metadata      1.7.0
imutils                 0.5.3
iopath                  0.1.8
ipydatawidgets          4.0.1
ipykernel               5.3.4
ipython                 7.16.1
ipython-genutils        0.2.0
ipywidgets              7.5.1
jedi                    0.17.2
Jinja2                  2.11.2
joblib                  0.16.0
jsonpatch               1.28
jsonpointer             2.0
jsonschema              3.2.0
jupyter-client          6.1.6
jupyter-core            4.6.3
K3D                     2.7.4
Keras-Applications      1.0.8
Keras-Preprocessing     1.1.2
kiwisolver              1.2.0
kornia                  0.5.0
llvmlite                0.34.0
Mako                    1.1.4
Markdown                2.6.11
MarkupSafe              1.1.1
matplotlib              3.3.0
mistune                 0.8.4
nbconvert               5.6.1
nbformat                5.0.7
networkx                2.4
ninja                   1.10.0.post2
notebook                6.1.3
numba                   0.51.0
numpy                   1.19.1
oauthlib                3.1.0
opencv-python           4.3.0.36
packaging               20.4
pandas                  1.1.0
pandocfilters           1.4.2
parso                   0.7.1
PasteDeploy             2.1.1
pbkdf2                  1.3
pexpect                 4.8.0
pickleshare             0.7.5
Pillow                  7.2.0
pip                     20.1.1
pix2vertex              1.0.3
plaster                 1.0
plaster-pastedeploy     0.7
plyfile                 0.7.2
portalocker             2.3.0
prometheus-client       0.8.0
prompt-toolkit          3.0.6
protobuf                3.13.0
psutil                  5.8.0
ptyprocess              0.6.0
pyasn1                  0.4.8
pyasn1-modules          0.2.8
pycparser               2.20
pycuda                  2020.1
Pygments                2.6.1
pyparsing               2.4.7
pyramid                 1.10.5
pyramid-mailer          0.15.1
pyrsistent              0.16.0
PySide2                 5.14.1
python-dateutil         2.8.1
python3-openid          3.2.0
pytools                 2021.1
pytorch-debayer         1.0.0
pytorch-msssim          0.2.1
pytorch3d               0.3.0
pytz                    2020.1
PyWavelets              1.1.1
PyYAML                  5.3.1
pyzmq                   22.0.2
redner-gpu              0.4.26
repoze.sendmail         4.4.1
requests                2.22.0
requests-oauthlib       1.3.0
rsa                     4.7.2
scikit-image            0.17.2
scikit-learn            0.23.2
scipy                   1.5.2
Send2Trash              1.5.0
setuptools              49.2.0
shiboken2               5.14.1
six                     1.10.0
sklearn                 0.0
SQLAlchemy              1.3.22
tabulate                0.8.9
tensorboard             1.15.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit  1.8.0
tensorflow              1.14.0
tensorflow-estimator    1.14.0
tensorflow-gpu          1.14.0
termcolor               1.1.0
terminado               0.8.3
testpath                0.4.4
threadpoolctl           2.1.0
tifffile                2020.8.13
tinycss2                1.1.0
tk                      0.1.0
torch                   1.8.1
torchaudio              0.8.1
torchfile               0.1.0
torchvision             0.9.1
tornado                 6.0.4
tqdm                    4.48.2
traitlets               4.3.3
traittypes              0.2.1
transaction             3.0.1
translationstring       1.4
typing-extensions       3.7.4.3
urllib3                 1.25.10
velruse                 1.1.1
venusian                3.0.0
visdom                  0.1.8.9
wcwidth                 0.2.5
webencodings            0.5.1
WebOb                   1.8.6
websocket-client        0.57.0
Werkzeug                1.0.1
wheel                   0.34.2
widgetsnbextension      3.5.1
wrapt                   1.12.1
WTForms                 2.3.3
wtforms-recaptcha       0.3.2
yacs                    0.1.8
zipp                    3.1.0
zope.deprecation        4.4.0
zope.interface          5.2.0
zope.sqlalchemy         1.3

@bottler
Copy link
Contributor

bottler commented May 28, 2021

I think you've ended up with a package from PyPI (notice that your pytorch3d is 0.3.0 instead of the latest 0.4.0).
Can you try removing pytorch3d and running (You might need pip install fvcore iopath if they get auto removed)

pip install --no-index -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py36_cu102_pyt181/download.html pytorch3d

I think the no-index will force pip to download from fbaipublicfiles.com not from PyPI.

(In general, I think putting pytorch3d at the end of the command is safer than before the -f.

pip install -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py36_cu102_pyt181/download.html pytorch3d

)

@kfiros1
Copy link
Author

kfiros1 commented May 28, 2021

For the first command:
pip install --no-index -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py36_cu102_pyt181/download.html pytorch3d

I get:

Looking in links: https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py36_cu102_pyt181/download.html
ERROR: Could not find a version that satisfies the requirement pytorch3d (from versions: none)
ERROR: No matching distribution found for pytorch3d

For the second:

pip install -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py36_cu102_pyt181/download.html pytorch3d

It has been installed but in version 0.3.0:

Looking in links: https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py36_cu102_pyt181/download.html
Collecting pytorch3d
  Using cached pytorch3d-0.3.0-cp36-cp36m-manylinux1_x86_64.whl (30.0 MB)
Requirement already satisfied: torchvision>=0.4 in ./core/venv /lib/python3.6/site-packages (from pytorch3d) (0.9.1)
Requirement already satisfied: fvcore in ./core/venv /lib/python3.6/site-packages (from pytorch3d) (0.1.5.post20210410)
Requirement already satisfied: torch==1.8.1 in ./core/venv /lib/python3.6/site-packages (from torchvision>=0.4->pytorch3d) (1.8.1)
Requirement already satisfied: numpy in ./core/venv /lib/python3.6/site-packages (from torchvision>=0.4->pytorch3d) (1.19.1)
Requirement already satisfied: pillow>=4.1.1 in ./core/venv /lib/python3.6/site-packages (from torchvision>=0.4->pytorch3d) (7.2.0)
Requirement already satisfied: termcolor>=1.1 in ./core/venv /lib/python3.6/site-packages (from fvcore->pytorch3d) (1.1.0)
Requirement already satisfied: yacs>=0.1.6 in ./core/venv /lib/python3.6/site-packages (from fvcore->pytorch3d) (0.1.8)
Requirement already satisfied: iopath>=0.1.7 in ./core/venv /lib/python3.6/site-packages (from fvcore->pytorch3d) (0.1.8)
Requirement already satisfied: dataclasses; python_version < "3.7" in ./core/venv /lib/python3.6/site-packages (from fvcore->pytorch3d) (0.8)
Requirement already satisfied: tabulate in ./core/venv /lib/python3.6/site-packages (from fvcore->pytorch3d) (0.8.9)
Requirement already satisfied: tqdm in ./core/venv /lib/python3.6/site-packages (from fvcore->pytorch3d) (4.48.2)
Requirement already satisfied: pyyaml>=5.1 in ./core/venv /lib/python3.6/site-packages (from fvcore->pytorch3d) (5.3.1)
Requirement already satisfied: typing-extensions in ./core/venv /lib/python3.6/site-packages (from torch==1.8.1->torchvision>=0.4->pytorch3d) (3.7.4.3)
Requirement already satisfied: portalocker in ./core/venv /lib/python3.6/site-packages (from iopath>=0.1.7->fvcore->pytorch3d) (2.3.0)
Installing collected packages: pytorch3d
Successfully installed pytorch3d-0.3.0
WARNING: You are using pip version 20.1.1; however, version 21.1.2 is available.
You should consider upgrading via the '/home/ks/code/core/venv /bin/python -m pip install --upgrade pip' command.

The same error I get when I import:
from pytorch3d import _C

I suspected in Using cached pytorch3d, then I did it without cache by using --no-cache-dir in the end.
However, it collects pytorch3d from the following:

Collecting pytorch3d
  Downloading pytorch3d-0.3.0-cp36-cp36m-manylinux1_x86_64.whl (30.0 MB)
     |████████████████████████████████| 30.0 MB 5.9 MB/s 

It's still 0.3 with the same error.

@bottler
Copy link
Contributor

bottler commented May 28, 2021

ERROR: No matching distribution found for pytorch3d

Ah, sorry. I wasn't looking closely enough. Your PyTorch version is 1.8.1. This is better - you should get an error and now do. We don't have builds yet for PyTorch 1.8.0 or 1.8.1. You need to install PyTorch3D from source. Or go back to 1.7.1.

@kfiros1
Copy link
Author

kfiros1 commented May 28, 2021

@bottler

Indeed, It was the problem, I've changed the version to 1.7.1 and it works.
I'll hope that in the future, the builds will be updated to versions 1.8.0 / 1.8.1.
(Anyway, If I'll run into a problem, I'll build it from source)

Thank you very much,
Kfir

@kfiros1 kfiros1 closed this as completed May 28, 2021
@facebookresearch facebookresearch locked as resolved and limited conversation to collaborators May 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
installation Installation questions or issues
Projects
None yet
Development

No branches or pull requests

3 participants