these are the Error messages I am geeting on running any of my project modules.
Traceback (most recent call last):
File "C:\Users\hsnl\BlockchainCodesTutor\Wallet.py", line 3, in <module>
import Transactions
File "C:\Users\hsnl\BlockchainCodesTutor\Transactions.py", line 2, in <module>
import Signatures
File "C:\Users\hsnl\BlockchainCodesTutor\Signatures.py", line 2, in <module>
import cryptography
ModuleNotFoundError: No module named 'cryptography'
I have already installed the cryptography module and was working perfectly until today I start getting this message that " No module named 'cryptography'".
I have again installed the cryptography as well as pip package but still showing the same error.
There might be loose versions running on your system. Please try the following:
python -m pip uninstall cryptography
python -m pip install cryptography
You can also check out this with python -m to make sure you are not using a loose pip.
You might not have cryptogtaphy installed correctly. I see you are using windows. Open commandline as an administrator and run pip install cryptography again. Enshure that the installation finishes without any errors and consider to restart your python interpreter after installation.
For further help you should post more details like the output of pip and your code leading to the error, so a more detailed answer for your problem can be given.
Try download cryptography whl from here.
Then use pip install cryptography-XXX.whl
For example:
pip install cryptography-3.3.1-cp36-abi3-win_amd64.whl
And now just supports python2.7 and python3.6.
Related
I'm using a Kubernetes inventory builder script found here: https://github.com/kubernetes-sigs/kubespray/blob/master/contrib/inventory_builder/inventory.py
On line 36, the ruamel YML library is imported using the code from ruamel.yaml import YAML. This library can be found here: https://pypi.org/project/ruamel.yaml/
On my OSX device (Mojave 10.14.3), if I run pip list, I can clearly see the most up to date version of ruamel.yaml:
If I run pip show ruamel.yaml, I get the following output:
I'm running the script with this command: CONFIG_FILE=inventory/mycluster/hosts.ini python3 contrib/inventory_builder/inventory.py 10.0.0.1 10.0.0.2 10.0.0.4 10.0.0.5
Bizarrely, it returns the following error:
Traceback (most recent call last):
File "contrib/inventory_builder/inventory.py", line 36, in <module>
from ruamel.yaml import YAML
ModuleNotFoundError: No module named 'ruamel'
I have very little experience with Python, so don't understand how this could be failing. Have I installed the library incorrectly or something? From the documentation on the ruamel.yml project page, it looks like the script is calling the library as it should be.
Thanks in advance
In my case, I was installing this with pip3 install ruamel.yaml, and it was puting the package in /usr/local/lib/python3.9/site-packages/, but the python3 binary on the machine was pinned to Python 3.7, so trying to import that module was sending the ModuleNotFoundError message.
What helped to fix this, was to install the module with python3 -m pip install ruamel.yaml, running pip via the python3 binary makes sure it runs on the same version, in this case 3.7, and gets installed via the correct version number site-packages.
pip is set to point to the Python 2 installation. To install the library under Python 3, do pip3 install ruamel.yml.
you're using python 3 and want to use the package that is with python 2. Go to the directory where your python 3 is, navigate to Scripts and use the pip in there to install the needed library.
This helped me (adding version number to python):
CONFIG_FILE=inventory/mycluster/hosts.yaml python3.6 contrib/inventory_builder/inventory.py ${IPS[#]}
[python 3.10.x].
There is no package called ruamel.yaml
what worked is pip install ruamel-yaml
I've looked at every post concerning this issue. I've (re)installed PostgreSQL on my Mac using Homebrew. I've adjusted the PATH variables. I've installed/uninstalled/reinstalled psycopg2. I've watched videos. Still, I cannot figure out how psycopg2 can be squarely on my machine and yet unavailable to my database and, by extension, my Flask application. Here is my latest error message with confirmation that, yes, it's there and, no, I can't use it (or Python won't acknowledge it). Any help would be greatly appreciated. This is day two of this nonsense.
RCD#Ryans-MacBook-Pro ~ - $ sudo pip3 install psycopg2
Password:
Requirement already satisfied: psycopg2 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (2.7.5)
RCD#Ryans-MacBook-Pro ~ - $ python
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import ( # noqa
ImportError: No module named _psycopg
So you've installed psycopg2 into Python 3.7 but tried to use it in Python 2.7.
python and pip must be synchronized; the simplest way to do that is to run python -m pip instead of pip, that way you guarantee that you use correct pip for your current python.
Please remember that sudo uses a different $PATH so you'd better set the full path to your python:
sudo /Library/Frameworks/Python.framework/Versions/2.7/bin/python -m pip install -U psycopg2-binary
I tried to install redis-py lib via pip. It was installed successfully, but when I tried to import redis in python3 shell, I got the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'redis'
In python2 it gets imported with no errors.
I have tried all three pip, pip2, pip3 on my machine (ubuntu 17.10). Also I have python3.6 installed. I also tried easy_install
You are installing it in Python 2.7 (you have probably already know this). If python3.6 brings up the correct Python version on your system then this should work for you:
python3.6 -m pip install redis
If you are unsure what each pip version brings up you can use the which command to list the file path. This will give you a good indication as to where to look.
Also pip3.6 install redis might work but is not as secure as the above
I am on Mac OS Sierra, with home-brew, pip and python3 installed. I Tried running a script that required the requests module, but I keep getting this error:
Traceback (most recent call last):
File "listing_seq.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Despite running:
sudo pip3 install requests
sudo pip install requests
sudo pip install requests --upgrade
Any suggestions?
Update:
When I try running using virtualenv I get:
Running virtualenv with interpreter /usr/local/bin/python3
ERROR: File already exists and is not a directory.
Please provide a different path or delete the file.
The most common error is having another file with the name of any of the libraries you requested in the same path.
The other possible error is if the python you are using to execute the file is not python 3 but rather the defalut python from your OSX. See the accepted answer on this for better understanding of a possible issue. Also share your code to identify the bug.
i am new to python, on my Mac, when i issue command
User:ihasfriendz user$ python main.py
Traceback (most recent call last):
File "main.py", line 2, in <module>
import json
ImportError: No module named json
I get error on json. how to add this library? i'm using 2.5 (the default came with leopard)
You can also install simplejson.
If you have pip (see https://pypi.python.org/pypi/pip) as your Python package manager you can install simplejson with:
pip install simplejson
This is similar to the comment of installing with easy_install, but I prefer pip to easy_install as you can easily uninstall in pip with "pip uninstall package".
AFAIK the json module was added in version 2.6, see here. I'm guessing you can update your python installation to the latest stable 2.6 from this page.
You can also install json-py from here http://sourceforge.net/projects/json-py/