Installed anaconda python libraries cannot be imported - python

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.

Related

I'm having problems with Anaconda recognizing the package "graphviz", even if it has been installed

Alright, so I installed Anaconda 2.3.2 and run it as admin, then I tried to import the package graphviz, so I installed it with:
conda install -c anaconda graphviz
which is what was recommended in the (official documentation for anaconda)
however, when I tried to import the package with either:
import graphviz
or just a function with
from graphviz import Source
I get the same error:
ModuleNotFoundError: No module named 'graphviz'
I tried installing the package again, but anaconda doesn't seem to recognize it (I'm using a jupyter notebook and everything else runs alright). Is there some other path that it's missing or something?
I tried reinstalling anaconda from scratch, but that didn't work either.
I finally got it to work, although it seems a bit cluncky... I had to use a double installation, by using the command
pip install graphviz
It finally started to be recognized, however, I also needed to use the "dot" command from the command line to transform a graph into a png image, and it wasn't being recognized, however, after I made a SECOND installation with:
conda install graphviz
For some reason, that made it work... at last.
Since Conda is a generic package manager - not just Python - one needs to distinguish somehow when a package is a Python wrapper versus a library or other compiled binary. In this case, the Python wrapper, which goes by graphviz on PyPI and delivers the graphviz module in Python, goes by python-graphviz on Conda. So, one would use
conda install python-graphviz
to get this. The upside here is that this Conda package lists graphviz as a dependency and so will also install that.

Python module shows up in pip freeze, but cannot be imported

I'm in Win10 and use vanilla Python 3.7.3 (e.g. not conda or anything). I had a successful pip install for the package, the package shows up in pip freeze, and the package is supposed to be compatible with my version of Python. I've seen several threads with similar issues on OS X and Linux, and have tried to emulate their solutions on Windows, but no luck. I'm guessing it could be an issue with my PATH variable, but I'm not quite sure. The error I get when trying to import is the "No module named" error.
Went into site-packages...for some reason the module was named Bio there (everywhere else it's named biopython, again, including pip freeze) and importing that worked. Not sure if this was just a bad dev choice or what.

Pip3 and python are not synchronized | ModuleNotFoundError: No module named 'numpy'`

So my problem started when in Spyder I wanted to import library from python (wget). Even though module was clearly installed (through both pip and conda) Spyder couldn't see it.
I tried to resolve the issue.
Firstly I reinstalled python - still same issue.
Now I try to reinstall whole conda environment.
But even though I removed conda after uninstalling modules for example numpy pip3 uninstall numpy, then installing pip3 install numpy I still get Error: ModuleNotFoundError: No module named 'numpy'
Honestly guys I have no clue now how can I resolve my issue and setup my python environment once again.
I'm running everything on macOS terminal.
So apparently reinstalling conda helped me to solve the problem.
The environment seems to be working fine.
For macOS I removed:
rm -rf ./anaconda3 from opt folder in users
removed anaconda3 from PATH
removed all anaconda3 dependencies
I leave the post, because maybe someone has the same issue.

ModuleNotFoundError: No module named 'win32crypt'

I'm trying to run a Python module for a school project and I am getting this error ModuleNotFoundError: No module named 'win32crypt' at line import win32crypt.
I've search the website for solution and encountered a post that states pywin32 is required. So I installed it with pip. I also tried installing pypiwin32. None of these installs worked. Now I've tried Dependency Walker to see if there are any dependencies missing and I see at least 100 DLLs that are. How can I fix the issue?
win32cryrpt is a part of the Windows Extensions for Python or pywin32. It is a wrapper around the Windows crypto API. It doesn't make sense to try and install it without pywin32 and if your install of that has failed then that is the problem you have to solve.
Please try pip install pypiwin32 again, being sure to execute it in the correct folder, which is the Scripts subfolder of the Python environment you want to install it in. You may have more than one Python installation without realizing it, and if you run pip from outside that folder, you may get a different instance of pip. The standard location for Python installations is C:\Program Files\Python3x. If the pip install doesn't complete as expected then edit your question to include the messages from the failed install. Did not work isn't enough to go on.

Installing shapefile / shapelib not found via conda or pip

I am trying to read shapefiles to view suburbs in a city following this tutorial using windows 8, Anaconda and iPython.
I tried "conda install shapefile" and "pip install shapefile" in command prompt, both returning "Error: No packages found matching: shapefile".
Besides that I tried adding it manually following these links [1]How to import a module given the full path?
[2]Import python module NOT on path. However I am getting permission errors which suggests I am not importing them correctly anyway.
Any suggestions on how to proceed or best practices are appreciated.
try
pip install pyshp
in your cmd.
that is the name of you library as far as I can see, see https://pypi.python.org/pypi/pyshp
conda only works for these http://docs.continuum.io/anaconda/pkgs.html packages.
For the ones not in the list you need to use pip install. It can be confusing as the name of the library on pypi (this is where pip goes to download it) is often, but not always the same as the import name, so if conda and pip don't work, first try to google to make 100% sure that your library is not on pypi, because most respectable libraries are...

Categories

Resources