I was trying to work with python virtualenv on the Zroya python wrapper around win32 API. Although I did installed the modules using pip, and although they are shown in cli using the command
pip freeze
,when trying to execute the .py file that uses the modules it shows the following error.
Traceback (most recent call last):
File "TesT.PY", line 2, in <module>
from zroya import NotificationCenter
ImportError: No module named 'zroya'
What is the reason for this cause ? I'm using python 3.4. When checked on
>>>help("modules")
on python cli, the modules that were installed using pip aren't listed.
Your virtualEnv is separate from OS Python environment.
Check whether you installed 'zroya' module in OS Python env or virtualEnv.
Run bin/activate in your virtual env, and check if 'zroya' module exists
>>>help("modules")
If no module named Zroya, run install command pip install xxx after activating virtual env.
Installing zroya should solve your problem.
Installation instructions: https://pypi.python.org/pypi/zroya
There seems to be some issue with the pip install. Copying the zroya directory from github repository over to PYTHONPATH resolved the conflict.
Related
I've installed the "openexr" package within my windows system. To do this, i used powershell from my blender installation folder "C:\Program Files\Blender Foundation\Blender 3.0\3.0\python" to launch the command ".\bin\python.exe -m ensurepip", for installing pip, and then "pip install openexer" to install the package.
Everything seems fine, but when I open blender and start to code with a simple
import openexr
I obtain this error:
Traceback (most recent call last):
File "\Text", line 1, in <module>
ModuleNotFoundError: No module named 'openexr'
Error: Python script failed, check the message in the system console
The module seems installed, but it's like blender cannot access it. Someone can help me? I would be extremely happy if this could work !
At the moment I tried to re-install pip or the openexr package, but the problem persist.
Also, if I try to re-install openexr, the system answer me that the package is already installed.
I have created a new conda environment and installed pymongo from conda-forge. pymongo should install bson module as part of its installation and it does, as running my script from terminal works just fine. I checked the env path with sys.executable and set the same environment in VSCode. Then switched to VSCode terminal and called the script from there (just using python script.py), with the same environment activated. However, I got an error:
Traceback (most recent call last):
File "src/script.py", line 2, in <module>
import bson
ImportError: No module named bson
Any ideas what may be the source of the error? I feel like there might be some issue specific to bson module, as other packages seems to work just fine.
The reason is that the location where this module is installed is not in the python environment currently used by VS Code or the module file is damaged.
Please enter "python --version" or "pip --version" in the VS Code terminal to check the python environment used by the terminal, and the module will be installed here:
In order to avoid the impact caused by the damage of the module file, we can find the location where the module was installed, delete the module folder, and then reinstall it: (pip show module)
run:
I used the command pip install requests in CMD and successfully installed the requests module, but when I try and import it to my file in PyCharm it throws
"ModuleNotFoundError: No module named 'requests'
I saw a couple other posts about this issue but did not find a working solution.
As a side note I have successfully run this code in my Python IDLE so I presume this is not a code issue, and just an issue with my PyCharm settings.
Traceback (most recent call last):
File "C:/Users/danie/PycharmProjects/Web_Scraping_Project/Web_Scraper.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Process finished with exit code 1
You have to activate the virtual environment.
source venv/bin/activate
pip install requests
Or you can add the library, from the PyCharm GUI.
There is a "+" on the edit interpreter in settings in the, click on it and search for the requests library.
Seems as if your project is using a virtualenv python environment. The pip install you did is probably on your system wide python installation.
You can install packages by activating your virutalenv (source path/to/venv/bin/activate) and using pip as usual, installing packages using the PyCharm interface (you can see a litte "+" button in your screenshot) or just by using the terminal in PyCharm (this should activate the virtualenv automatically).
My operating system is Ubuntu 17.10.
I have am trying to run (and develop) a python project, but when I do I get:
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f8c459bf740 (most recent call first):
I have tried advice from ImportError: No module named 'encodings', namely:
I have removed old virtual environment,
create a new one, named venv
run source venv/bin/activate
pip install -r requirements.txt
Also, in pycharm, I have gone File > Settings > Project > Project Interrupter - and set this to use the same virtual environment.
I have also tried sudo dpkg-reconfigure python3
But I still get the same error.
I've found this message to be caused, on setting up uwsgi, by an invalid pointer to the virtual environment in the ".ini" file.
I was facing a similar issue "ModuleNotFoundError: No module named 'encodings" after updating to macOS Catalina.
I was having multiple versions of Python installed in my system.
Removing all the python versions(2.7 and 3.7.4) from macOS system and reinstalling the latest python 3.8 worked for me.
To remove a python from macOS, I've followed the instructions from here How to uninstall Python 2.7 on a Mac OS X 10.6.4?
I installed the package python-gconf on Ubuntu 12.04 and played with it: it's a python binding to the gnome configuration tool, and there is no pypi package for it.
As soon as I created a virtualenv (without --no-site-packages), any attempt to import gconf would lead to ImportError.
The gconf module works fine at the system level, but not in the virtual env. I investigated, and opening python-gconf.deb teached me that it's just a gconf.so binary.
Searching for it tells me it's been installed in /home/lib/python2.7/dist-packages/gtk-2.0/gconf.so
I did try to force Python hands:
sudo ln -s /usr/lib/python2.7/dist-packages/gtk-2.0/gconf.so ~/.virtualenvs/appetizer/lib/python2.7/site-packages/
But it only resulted in:
>>> import gconf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: could not import gobject (error was: 'No module named gobject')
So I'm guessing it's very dependant to GTK.
You should create your virtualenv using --system-site-packages option to make all system packages visible. Symlinking external packages into virtualenv's structure also works for most situations when you need only one external package.
If you have already created your virtual environment, just remove the no-global-site-packages.txt file from it to make it see system packages.