ModuleNotFoundError when installing packages - python-3.x

I've been having a problem with installing packages in PyCharm. This started happening a few months ago, but before that it was fine. I can install it from the cmd using pip, but when I try to import it into the IDE it gives this error:
ModuleNotFoundError: No module named '_winreg'
and isn't available for use. The package I'm trying to install right now is pygame, but it has had trouble with other ones. I tried to make sure I have winreg installed by using 'pip3 install winreg' in the cmd, but it gives error text saying, "Could not find a version that satisfies the requirement winreg." What am I doing wrong?
Also, if it helps, I'm using Windows and the latest version of PyCharm, as well as python 3. Thanks for the help, I've been looking for a while now.

I think one of your problems possibly is that you didn't add pygame in your project interpreter. (To add it go to File -> Settings -> Project Interpreter then click the green plus sign and search for pygame.) I don't know if this will work for winreg, but tell me if it does.

I can't find _winreg anywhere, I've searched winreg's file, and modules , there don't seems like any of _winreg. I think you probably want to import winreg, not _winreg.
And also, if you are using PyCharm's venv, you need to use the project's prompt to import,or project interpreter.
Could not find a version that satisfies the requirement sometime means your python's version is too new for the module to use.

Related

ModuleNotFoundError: No module named 'Sastrawi'

I've been looking for a solution to this problem, they said just install Sastrawi module with pip install Sastrawi , but after I installed the module, the error still doesn't go away.
what do i need to do?
I want to answer my own problem
So, for the problem I've had, I previously installed the literary library on the laptop's CMD.... I should have installed it in jupyter itself, not on the laptop's CMD.

ModuleNotFoundError: No module named '<module.name>' - Installation error

I am building a desktop app using Python and PySimpleGUI. So far, everything works just fine. Whilst I was working at the project, I realized I need to find a way to get the duration of some mp3 files and to display it in a certain way. I discovered mutagen module that is supposed to help me in this sense, I installed, and here the problem arise:
It throws me ModuleNotFoundError: No module named 'mutagen'.
Seeing this, I started to look for the problem, but I couldn't not understand why my interpretor did not find the module even though I Installed it CORRECTLY. (as PyCharm told me)
I have tried the following:
I am using a local virtual environment that has installed the dependecies for the project(and some extra) and I uninstalled and installed the package 3-4 times
I deleted the local virtual environment and I created another one. I installed the packages again and same issue.
I installed a random module (scipy) and I tried to import it somewhere in the project and it thrown me same error, but this time for scipy module
My guess is that I did not configured properly my interpreter, but to be honest, I have no idea what I am doing wrong, because I followed the same steps I've been using for creating a venv with its according interpreter and for other projects, it worked just fine.
Further details:
Using python3.9 base .exe
I installed the packages in two ways: one using the pycharm IDE, and one by running pip3 install mutagen
You may be using a different pip that is not the one that affects the Python you are using. Instead of using
pip install mutagen
Consider using pip as a module of the Python you are using:
python -m pip install mutagen
This way you'll be sure you are working on the same Python.
If you want to continue using plain pip, try which python and which pip to make sure they are referencing the same environment.

import win32api in python 3.7 resulting in dll import error

I am having the error while running jupyter notebook. Error replication:
python --version
Python 3.7.9
python
import win32api
The error was: ImportError: DLL load failed
After doing a some stackoverflow, I got to know that there are 2 dll files missing namely: pythoncom37.dll and pywintypes37.dll
I also got to know that I can run this post command: pywin32_postinstall.py in the Scripts folder. I ran this script. Restarted my pc. I manually download these two dll and copied it to my system32. After manually downloading, I started to have a different type of error: ImportError: DLL load failed: %1 is not a valid Win32 application
I used anaconda and ran my jupyter notebook which was my main aim but can you please make me aware as what is going wrong?
I've run into this recently, but with a different version of the DLLs. What solved it for me was using a different version of pywin32.
My solution (conda env, python 3.8.5):
pip install pywin32==300
or try 225, 227, 228. The latest pywin32 (301 as of this post) seems to be having dll search issues (I wouldn't be surprised if whatever version you were using is also having dll search issues). 301 was released after your issue started, but you may have a similar problem nonetheless.
There is currently an issue on pywin32 DLL loading failing: https://github.com/mhammond/pywin32/issues/1709
Factors involved (in my experience) include your PATH variable (if you're using conda). I haven't tested it myself, but I'd be curious to see if this issue occurs without conda. This issue stops happening for me if the first dlls found are those for 301. In my case, that means putting them in my C:\Windows\System32 folder (yeah I'm on Windows; joy).
So a possible solution #2 would be to run the pywin32 post install script which should be located under your venv/Scripts/pywin32_postinstall.py
To try that solution, open an ADMIN command prompt (very important that it's admin), navigate to your venv, and run:
ppython.exe Scripts\pywin32_postinstall.py --install
You shouldn't HAVE to do this, but if you just need a one-off solution and it works, great!
pip install --upgrade pywin32 ==225 worked for me. Tried version 300 and was unsuccessful.

Installing activity-browser - progressbar error

I am trying to install the activity-browser for brightway2 on Mac OS X. In the terminal and in my b2-python directoy, I write:
bin/pip install https://bitbucket.org/cmutel/activity-browser/get/2.0.zip
The installation starts nicely with downloading and checking the required packages. For progessbar-ipython however, I get an error an the installation stops:
File "/private/var/folders/7h/4zl3jkyd4dzgc464d3ljvv7h0000gn/T/pip-build-m1_3y3zc/progressbar-ipython/progressbar/__init__.py", line 49, in <module>
from compat import *
ImportError: No module named 'compat'
I have learned that the error comes from support for python 2.4 only, as described here: https://github.com/niltonvolpato/python-progressbar/issues/28 , and here: https://bbs.archlinux.org/viewtopic.php?id=209444
Unfortunately, I don't get it installed. Admitted, I am not very familiar with manually installing packages. Attempts with replacing the cached version with a corrected one as described in the links have failed so far.
Do you have any ideas and suggestions? Thanks a lot!
Best wishes, Niklas
It looks like you haven't activated the right environment. I assume you have followed the installation instructions. If so, you need to make sure to activate with brightway2 environment with something like source ~/bw2-python/bin/activate bw2.
progessbar-ipython hasn't been a dependency for a long time. I guess the development versions of bw2-* should be official releases instead of devX, as this is just causing problems.

Install pybrain on python 3.2

I'm trying to install pybrain on python 3.2. It says here: https://github.com/pybrain/pybrain/pull/85 that it should work. However it does not for me.
I tried:
$export PYTHONPATH=$PYTHONPATH:'/home/luis/Documents/pybrain/'https://github.com/pybrain/pybrain/pull/85
which works well for python 2.7.
Did somebody get it to work?
After hours of "what the hell?!"s I installed it.
First the installer suggested is not updated for Python3 so I installed Distribute. With that installed I was able to use python setup.py install in the directory where I unrared pybrain. It gave a ton of errors. So I found this article (god bless google translate) and used 2to3 on pybrain directory. After I tried to install it again it gave an error on from string import split so I edited the file and removed that line (it is not needed really) and tried yet another time. This time no errors occurred and I was able to import pybrain without any problems. The same problem with the from string import split occurs in utilities.py again, so edit that line too.
I used 2to3 to turn examples to python3 too. benchmarkplots.py seems to work.
Update:
pybrain now supports python3
Here's how to install if you run into trouble
pip install https://github.com/pybrain/pybrain/archive/0.3.3.zip
Or just grab latest github pybrain release.

Resources