Python module not found despite being installed poetry - python

I think poetry is somehow not in sync with my python compiler.
Running poetry add bcrypt etc. and then running python app.py I get
ModuleNotFoundError: No module named 'bcrypt'
This persists with some other modules, while seemingly it is working with some.
I set poetry env use to which python output, but it still does not work.
What could be wrong? I'm using linux mint.

Which python version you used while installing module and while running the code, it should be same.
Check if the modules is present under Python{version}/lib.
If not try installing with the same python you are using try again.
If not there may be environment variable issue, set the same python version
in ev

Related

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.

Unable to load python entry_point when developing python package

I am trying to develop a python package that is importable and also has entry_point to call from shell.
When trying to call the entry point I get:
pkg_resources.VersionConflict: (pysec-aws 0.1.dev1 (/Users/myuser/PycharmProjects/pysec-aws), Requirement.parse('pysec-aws==0.1.dev0'))
Essentially what I did before getting this error, is incrementing the version from 0.1.dev0 to 0.1.dev1 in setup.py, and running python setup.py sdist and then pip install -e .
What am I doing wrong? What is the proper way to install development versions of packages you are actively developing and bundling with setuptools?
The error is complaining that the application version does not match the version declared in setup.py. Try checking the __version__ set in your application.
You might consider using a single source for the version to avoid this problem. There are a number of different options outlined at https://packaging.python.org/guides/single-sourcing-package-version/. One simple technique, if there are not any external dependencies, is
import myapp
setup(
...
version=myapp.__version__
...
)
The only thing that fixed this issue was to create a new virtualenv.
Apparently my virtualenv/bin had compiled (.pyc) and non-compiled (.py) references to the old version for some reason - they were probably not upgraded / removed when I installed the new version.
Once I created a new virtualenv and re-installed required packages I was able to resolve this issue.

trouble with importing python modules

I am trying to import Python packages that I had previously installed but I keep getting this error when trying to import it
"ImportError: No module named gdal"
In the images attached (in the link :P) you can see that the package python-gdal and python-numpy are installed. I am also attaching the python output.
P.S = I am using Ubuntu and running python from the terminal.
You have possibly installed a non-Ubuntu version of Python - Anaconda - yet these packages are installed into the system Python. You should probably remove Anaconda, and/or run the system Python explicitly as /usr/bin/python.

Could I get a list of modules that I installed using easy_install?

Recently, I installed trac on my local machine for testing purposes.
To get it running, I needed to install several support modules using easy_install.
Now, I'm going to take my local installation and move it to a real server that has no Python installed yet.
While moving the trac installation itself seems trivial (http://trac.edgewall.org/wiki/TracBackup, https://serverfault.com/questions/6147/how-do-i-backup-my-trac-instalations), actually getting it running needs the modules that I installed with easy_install.
Is there a convenient way (such as for example PPM for Perl) that I could use in order to get the same modules installed on the server that I have on my local machine?
If you don't use pip, only use easy_install, try https://pypi.python.org/pypi/yolk
Install Pip, and then
pip freeze
You can also use help function in python to get the list of modules installed. Get into python prompt and type the following command.
help('modules')

importError: no module named _winreg python3

Where can I download _winreg for python3 if I can at all. I have my 'windir' on E:\Windows. I do not know if cx_Freeze did not notice that. I am using cx_Freeze to create an msi installer.
As it says in the _winreg documentation, it has been renamed to winreg in Python 3.0. You should run the 2to3 tool if you're converting code that was written for Python 2.x.
I know this is an old question, but this was the first search result when Googling for ModuleNotFoundError: No module named '_winreg', and perhaps may be helpful for someone.
I got the same error when trying to use a virtual environment folder, which has been created using different (already deleted) python binaries. The solution was recreate the virtual environment:
Delete the virtual environment folder
Run python -m venv <name_of_virtual_environment>
I have found an easy solution for this, Even though i found it after a lot of Rnd, the solution implementation is so simple and straight forward. Hope it can help many people with the same problem.
If you dont have the latest version of Python installed on your machine, You need to download it from (https://www.python.org/downloads/) and then click on Add to path option and just finish the installer.
Please open CMD and move to the python latest version directory, then run the pip install package name (e.g) pip install pygame and it will be successful
1. C:\WINDOWS\system32>cd C:\Users\admin\AppData\Local\Programs\Python\Python37-32
2. C:\Users\admin\AppData\Local\Programs\Python\Python37-32>pip install Pygame
It will install the packages now without any issues.
Downloading
Successfully installed Pygame-1.9.4
C:\Users\admin\AppData\Local\Programs\Python\Python37-32>
If you are still facing issues in Pycharm after trying the above solution, please try the following steps too.
Create new virtual Environment from settings menu and select the latest version of python framework as Project Interpreter and give a new folder path.
select the pip package you want to import. Recompile the code and the error will clear.
Hope this helps.
When you encounter an error like module of simpleai not found,
use
pip install simpleai
in the prompt and then execute. It will get installed.

Categories

Resources