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

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.

Related

Installing and using npTDMS with Spyder - anaconda3

I have successfully installed npTDMS as seen here:
https://pypi.org/project/npTDMS/
If I try to install with command line using either pip or conda I get a message confirming it is already installed, and I see the package at D:\Users\username\anaconda3\pkgs.
On Spyder I have tried using the PYTHON path manager (in the tools menu) to add both:
D:\Users\username\anaconda3\pkgs\nptdms-1.2.0-pyhd8ed1ab_0
D:\Users\username\anaconda3\pkgs\nptdms-1.2.0-pyhd8ed1ab_0\site-packages\nptdms
As far as I understand this should be enough to use the npTDMS package, however when I try to import I get a ModuleNotFoundError: No module named 'nptdms'.
I'm fairly new to python overall so maybe there is a simple thing I am missing.
This issue comes when there are multiple versions of python or any package you are running at current time. The same issue was with me too when the IDLE was not able to detect the position of where the package is installed.
My suggestion is that uninstall all the versions of python and the module you are using and install them again. Otherwise shift to any other IDLE, in my recommendation - Visual Studio Code.

How to fix module installation problems with the python path

I was trying to install the python chess module and kept getting the same error: ModuleNotFoundError: No module named 'chess'
I looked at some other code and noticed the same problem of not importing the module even though it worked before (in this case it was from sklearn.model_selection import train_test_split).
I figured the problem was that I put all my code in a new folder. Once I took out all of my code from this folder it was able to work, but the chess module still didn't. This made me think that it must be an issue with the path.
Since I use quite a few folders in order to organize my work. How do I fix this?
I don't want to take out all of my code from every folder I have.
I am using VSCode, and I have already installed the chess module, several times, using pip, pip3, python -m install pip, conda, in the command prompt, terminal in VSCode, and miniconda.
So it is not an installation problem.
You can install module manually,
pip install python-chess
Run this command in virtual environment, this will install python chess module

ModuleNotFoundError: No module named 'yyy' in Windows Shell

I'm using Python 3.6 on Windows 7.
I have a script that uses standard python packages.
The script run fine from IDLE.
It used to run fine from Windows command too, but not anymore.
I don't know why. It complains about missing package like:
, line 4, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
The path looks ok (I've added all path found from IDLE / Path Browser):
PATH=C:\Users\olivier\AppData\Local\Programs\Python\Python36\lib\site-packages;C:\Users\olivier\AppData\Local\Programs\Python\Python36\Lib;C:\Users\olivier\AppData\Local\Programs\Python\Python36\DLLs;C:\Users\olivier\AppData\Local\Programs\Python\Python36\python36.zip;C:\Users\olivier\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\olivier\AppData\Local\Programs\Python\Python36\;C:\Users\olivier\AppData\Local\GitHubDesktop\bin
Any idea?
Thanks
I had the same problems. Did you try to install it through pip and did you try to install on the strict path by using pip install --target="..." for e.g "pip install --target=C:\U2\UV\python\Lib\site-packages geopy" and pasting it in python console?
Also look at this post: Install a module using pip for specific python version
These two points can help you to solve the problem as per my knowledge.
Are you using two Python versions?
Check the Environmental Variables and if everything is fine there, it's better to uninstall and reinstall it again. use pip for installing and uninstalling

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 Anaconda and the modules not working

I have just installed Anaconda and then when I tried to use Idle to use the module statsmodels it tells me it doesn't exist:
ModuleNotFoundError: No module named 'statsmodels'
If I then try installing the module using pip it tells me its there.
I have also tried uninstalling Anaconda and installing the modules separately but the connection times out. error image
I am at work so could this be due to the pip module being unable to get through the proxy?
If that is the case why did Anaconda not seem to work either?
I am still unable to get the libraries working on Idle. But I have started using Spyder, which came with Anaconda and all the libraries are working there.
This is fine for my purposes. Though it would be good to know why?
Thanks
Have you tired installing the individual packages via pip? I am running into the same problem. It was working for some, not for others....

Categories

Resources