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

ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory #47

Closed
alejandroarmas opened this issue Jul 17, 2020 · 7 comments

Comments

@alejandroarmas
Copy link

I am having trouble running a python script on a computing cluster and the problem is reproduced when I run my job on slurm:

I get the error


2020-07-17 19:30:57.289439: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-07-17 19:30:57.289506: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    from acme.agents.tf import dqn
  File "/home/armas/temp/dist_rl/lib/python3.7/site-packages/acme/agents/tf/dqn/__init__.py", line 18, in <module>
    from acme.agents.tf.dqn.agent import DQN
  File "/home/armas/temp/dist_rl/lib/python3.7/site-packages/acme/agents/tf/dqn/agent.py", line 20, in <module>
    from acme import datasets
  File "/home/armas/temp/dist_rl/lib/python3.7/site-packages/acme/datasets/__init__.py", line 17, in <module>
    from acme.datasets.reverb import make_reverb_dataset
  File "/home/armas/temp/dist_rl/lib/python3.7/site-packages/acme/datasets/reverb.py", line 22, in <module>
    from acme.adders import reverb as adders
  File "/home/armas/temp/dist_rl/lib/python3.7/site-packages/acme/adders/reverb/__init__.py", line 21, in <module>
    from acme.adders.reverb.base import DEFAULT_PRIORITY_TABLE
  File "/home/armas/temp/dist_rl/lib/python3.7/site-packages/acme/adders/reverb/base.py", line 26, in <module>
    import reverb
  File "/home/armas/temp/dist_rl/lib/python3.7/site-packages/reverb/__init__.py", line 27, in <module>
    from reverb import item_selectors as selectors
  File "/home/armas/temp/dist_rl/lib/python3.7/site-packages/reverb/item_selectors.py", line 19, in <module>
    from reverb import pybind
  File "/home/armas/temp/dist_rl/lib/python3.7/site-packages/reverb/pybind.py", line 1, in <module>
    import tensorflow as _tf; from .libpybind import *; del _tf
ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

On my local machine, I was struggling with same issue when I was running a virtual environment, I solved this problem simply with sudo apt-get install libpython3.7.

Here's some other things that may be helpful to know.

$which libpython
/usr/bin/which: no libpython in (/home/armas/temp/dist_rl/bin:/om2/user/armas/anaconda/bin:/om2/user/armas/anaconda/condabin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)

$echo $PATH
/home/armas/temp/dist_rl/bin:/om2/user/armas/anaconda/bin:/om2/user/armas/anaconda/condabin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

If there's anything I missed please let me know and I'll be sure to add, thank you again!

@Juze1500
Copy link

Hello! Try export LD_LIBRARY_PATH=/path/to/libpython/directory before executing your python script. If you are using Conda, the path should be /path/to/conda/envs/your_env/lib.

@alejandroarmas
Copy link
Author

alejandroarmas commented Jul 21, 2020

@Juze1500 Thank you! I had done that many times before and it didn't work out. Turns out I had installed an outdated python version for my anaconda environment. After getting that figured out I got the same problem but changing my LD_LIBRARY_PATH variable fixed it. Appreciate the help man!

@jasonmeverett
Copy link

Hello! Try export LD_LIBRARY_PATH=/path/to/libpython/directory before executing your python script. If you are using Conda, the path should be /path/to/conda/envs/your_env/lib.

This worked for me. Thanks!

@wookayin
Copy link
Contributor

wookayin commented Nov 12, 2021

Recommend putting the export LD_LIBRARY_PATH=.. into $CONDA_PREFIX/etc/conda/activate.d/env.sh, so that this environment variable set whenever the conda environment is activated.

You can do this with a one line command:

echo "export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:\$LD_LIBRARY_PATH" > $CONDA_PREFIX/etc/conda/activate.d/env.sh

@gattia
Copy link

gattia commented Jan 9, 2022

@wookayin do you know how this same principle could be used to remove $CONDA_PREFIX/lib from LD_LIBRARY_PATH if the environment is deactivated? Or if you are using the base conda environment?

Thanks!

@gattia
Copy link

gattia commented Jan 9, 2022

For anyone looking how to deactivate what I did is posted here: opensim-org/opensim-core#2968 (comment)

I still am not sure if there is anything that can be done to add/remove from path when the base conda is used.

@saltfishh
Copy link

Hello! Try export LD_LIBRARY_PATH=/path/to/libpython/directory before executing your python script. If you are using Conda, the path should be /path/to/conda/envs/your_env/lib.

thanks, it helps me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants