2

I am trying to understand the proper way to go about solving an issue.

Background: I have Anaconda installed with the default python 3.7.7

Ubuntu 20.04 LTS

I am trying to run a program with python 3.6.8. So I made a conda environment and installed python 3.6.8.

The problem runs that in their install instructions they require making links in /usr/lib for instance like below:

sudo ln -s $HOME/miniconda3/lib/libpython3.6m.so /usr/lib/libpython3.6m.so

This doesn't seem like the best way to do so, though because it breaks the encapsulation of a conda environment.

What is the correct way to add libraries so that they work correctly with a conda environment?

Edit:

A comment below led me to : https://stackoverflow.com/questions/46826497/conda-set-ld-library-path-for-env-only

Which seems a better solution than linking the library manually.

4
  • That does seem weirdly contrary to the entire point of running conda. Perhaps you don't have your lib PATH ENV exported properly?? Perhaps this might point you in a useful direction stackoverflow.com/questions/39298681/… Can you install libpython3.6-dev in the conda env? May 17, 2020 at 22:54
  • 1
    That comment actually helped a ton. It is a much better solution than linking manually. It led me to this answer which seems ideal: stackoverflow.com/questions/46826497/… This way I can set and unset the environment variables when activating and deactivating environments.
    – nbstrong
    May 17, 2020 at 23:24
  • I wonder, though, why conda doesn't do this automatically for the environment lib folder.
    – nbstrong
    May 17, 2020 at 23:32
  • Which version of Linux and which release number is in use? Different releases have different tools. Please click edit and add that to your question; please do not use Add Comment as that's our one-way channel to you.
    – K7AAY
    May 17, 2020 at 23:39

1 Answer 1

0

The best way is to setup a conda environment with a specific version of python, using python provided by conda, rather than trying to install or use a version of python provided by your operating system (Ubuntu).

conda create --name yourenvironmentname python=3.6.8
conda active yourenvironmentname

Then you should be able to run your program.

For further reading, consult the official documentation: https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-python

1
  • 1
    This isn't helpful. I stated in my question: So I made a conda environment and installed python 3.6.8.
    – nbstrong
    May 17, 2020 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .