0

I'm setting up a Python/conda enviroment on Ubuntu. I installed some common Python libraries such as tensorflow via conda install or pip install. Via pip show ... I found out they are all installed in the following folder: /home/anaconda3/lib/python3.8/site-packages/. However, when running them in Spyder I get the ModuleNotFoundError: No module named 'tensorflow' error message, for about every library (including matplotlib).

How can I fix this? I read this post about how they apparently need to be installed in /home/anaconda3/envs/[name env]/lib/python3.7/site-packages/ (/home/anaconda3/envs/ is an empty folder for me). However, the quick fix mentioned doesn't work for me.

Is there some way to add /home/anaconda3/lib/python3.8/site-packages/, use it as default, or is their a way to reinstall packages such that they will work?

Curiously enough, I did manage to get pygrib working via conda install -c conda-forge pygrib=2.0.1, but I'm not sure whether this is the way to go for all packages and would like to know what this does differently.

Daan R
  • 58
  • 9
  • 1
    What python interpreter is your spyder set up to use? Probably not the one at `/home/anaconda3`? – FlyingTeller Nov 20 '20 at 15:13
  • @FlyingTeller apparently `/usr/bin/python3.6`. – Daan R Nov 20 '20 at 15:17
  • 1
    Then that is the problem. Spyder will need to be configured to use the version from anaconda to be able to import the modules installed there – FlyingTeller Nov 20 '20 at 15:20
  • Yeah that was the solution. I apparently had 2 Spyders installed, and only one used the conda interpreter. Thanks a lot! I you want to, post it as an answer so I can accept it. – Daan R Nov 20 '20 at 18:21

0 Answers0