agents icon indicating copy to clipboard operation
agents copied to clipboard

Problem with reverb inside conda environment

Open a-berg opened this issue 3 years ago • 4 comments

Steps to reproduce:

conda env create -n tf-agents
conda activate tf-agents
pip install tf-agents[reverb]
python
>>>import reverb

The error I get is:

ImportError: libpython3.10.so.1.0: cannot open shared object file: No such file or directory

It doesn't matter whether I use python 3.8, 3.9 or 3.10 inside the environment. Does reverb expect libpython be installed in the system instead of the conda env and doesn't find it? (IIRC, system python is 2.7.18 / python3 == 3.8.10, defaults to 2.7)

a-berg avatar Mar 16 '22 20:03 a-berg

If you are using ubuntu or another debian based OS try:

sudo apt-get install libpython3.10

makisgrammenos avatar Mar 17 '22 14:03 makisgrammenos

I have the same problem.

When I try sudo apt-get install libpython3.10, the output is:

WechatIMG55

Step to reproduce:

conda create -n tf-agents python
conda activate tf-agents
pip install tf-agents[reverb]
python
>>>import reverb

The error I get is:

File "xxx/anaconda3/envs/tf-agents/lib/python3.10/site-packages/reverb/pybind.py", line 4, in <module>
    from .libpybind import *
ImportError: libpython3.10.so.1.0: cannot open shared object file: No such file or directory

But I can find the file ( libpython3.10.so.1.0 ) in ···/anaconda3/envs/tf-agents/lib. WX20220410-223215@2x

Can you help me solve this problem?

Thank you in advance.

jammy-li avatar Apr 10 '22 14:04 jammy-li

I have been having the same problem.

It looks like it is linked to the LD_LIBRARY_PATH environmental variable.

Assuming you are using miniforge3, running this makes the error go away:

export LD_LIBRARY_PATH=~/miniforge3/envs/your_env_name/lib:$LD_LIBRARY_PATH

(libpython3*.so* is in the lib folder of your environment directory)

Also, when I did that, I found out that pip created an inconsistent environment when it installed reverb using this command from tensorflow

pip install tf-agents[reverb]

With that command, it only works by ensuring numpy>=1.25, with reverb==0.7.0; or lowering the version number of reverb).

Right now, my environment with working version numbers are:

  • dm-reverb==0.6.0
  • numpy==1.21.5 (kept for cross compatibility with numba)

Fixing this will probably mean modifying the activate command to include the */lib directory, since there are a few packages that look like they are depending on it.

tgohh avatar Apr 12 '22 01:04 tgohh

I have solved this problem successfully.

If you can find libpython3.10.so.1.0 in /path-to-conda/envs/your-env-name/lib and your IEDA is 'PyCharm', you can try the following methods:

  1. select the file contained import reverb.
  2. Run->Edit configurations.
  3. add LD_LIBRARY_PATH=/home/zmli/anaconda3/envs/tf-agents-nightly/lib in environment variables.
  4. run the file.

jammy-li avatar Apr 26 '22 06:04 jammy-li