I am using a module for a work called cryptography and tried to install it via:
C:\Users\Administrator\Desktop>python -m pip install cryptography
Here is a copy of the cmd window:
Collecting cryptography
Using cached cryptography-3.2-cp38-cp38-win32.whl (1.3 MB)
Requirement already satisfied: six>=1.4.1 in c:\users\administrator\appdata\roaming\python\python38\site-packages (from cryptography) (1.15.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\program files (x86)\python38\lib\site-packages (from cryptography) (1.14.3)
Requirement already satisfied: pycparser in c:\program files (x86)\python38\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography) (2.20)
Installing collected packages: cryptography
Successfully installed cryptography-3.2
Then when I tried using the program it just did not work:
C:\Users\Administrator\Desktop>main.py
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\ape esse\main.py", line 3, in <module>
from cryptography.fernet import Fernet
ModuleNotFoundError: No module named 'cryptography'
It gives the same error, as if not installed, and I don't know what to do.
One of my friends said it was a problem with my python installation but I've already repaired and reinstalled it and it still gives the same error.
I installed it now using
pip install cryptography --no-cache-dir and it worked perfectly fine on python 3.8.5.
so you might want to try it.
Related
I would like to import pdfplumber and tried
import pdfplumber
and caught error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-b3d6737fd8e1> in <module>
----> 1 import pdfplumber
ModuleNotFoundError: No module named 'pdfplumber'
Tried to install using pip3 install pdfplumber and it returned:
Requirement already satisfied: pdfplumber in c:\python38\lib\site-packages (0.5.26)
Requirement already satisfied: pdfminer.six==20200517 in c:\python38\lib\site-packages (from pdfplumber) (20200517)
Requirement already satisfied: Wand in c:\python38\lib\site-packages (from pdfplumber) (0.6.5)
Requirement already satisfied: Pillow>=7.0.0 in c:\python38\lib\site-packages (from pdfplumber) (7.2.0)
Requirement already satisfied: sortedcontainers in c:\python38\lib\site-packages (from pdfminer.six==20200517->pdfplumber) (2.3.0)
Requirement already satisfied: chardet in c:\users\harper.guo\appdata\roaming\python\python38\site-packages (from pdfminer.six==20200517->pdfplumber) (3.0.4)
Requirement already satisfied: pycryptodome in c:\python38\lib\site-packages (from pdfminer.six==20200517->pdfplumber) (3.10.1)
WARNING: You are using pip version 20.3.3; however, version 21.0.1 is available.
You should consider upgrading via the 'c:\python38\python.exe -m pip install --upgrade pip' command.
But Command Prompt showed that I already have installed the module?
>>> pdfplumber
<module 'pdfplumber' from 'C:\\Python38\\lib\\site-packages\\pdfplumber\\__init__.py'>
But import pdfplumber returned the same erro. How to import pdfplumber?
I guess it has to do with the Python version that I used.
In the top right hand corner of VS Code it shows that my Python version was Python 3
Clicking on it and changing it to Python 3.8.5 and the code worked. This was done after I restarted VS Code and my laptop, and created new path.
Creating a new path in Environment Variables following these resources:
1. 'pip' is not recognized as an internal or external command
2. 2020 How to Fix "No Module Named..." Error in Python | Python Tutorial
3. Python Virtual Environments: A Primer
4. '' is not recognized as an internal or external command, operable program or batch file
I have installed scikit-surprise in Windows10.
C:\Users\Cosmos Lord>pip install scikit-surprise
Requirement already satisfied: scikit-surprise in c:\users\cosmos
lord\appdata\roaming\python\python37\site-packages (1.1.0) Requirement
already satisfied: joblib>=0.11 in c:\users\cosmos
lord\appdata\roaming\python\python37\site-packages (from
scikit-surprise) (0.14.0) Requirement already satisfied: numpy>=1.11.2
in c:\users\cosmos lord\appdata\roaming\python\python37\site-packages
(from scikit-surprise) (1.17.2) Requirement already satisfied:
scipy>=1.0.0 in c:\users\cosmos
lord\appdata\roaming\python\python37\site-packages (from
scikit-surprise) (1.3.1) Requirement already satisfied: six>=1.10.0 in
c:\users\cosmos lord\appdata\roaming\python\python37\site-packages
(from scikit-surprise) (1.12.0)
But I am still unable to import surprise module.
In Spyder3 kernel, the following error is shown:
import surprise
Traceback (most recent call last):
File "", line 1, in
import surprise
ModuleNotFoundError: No module named 'surprise'
Whereas in IDLE(Python-32 bit), the following error is shown:
Traceback (most recent call last): File "C:/Users/Cosmos
Lord/Documents/Flask Projects/New folder/aaa.py", line 1, in
import surprise File "C:\Users\Cosmos Lord\AppData\Roaming\Python\Python37\site-packages\surprise__init__.py",
line 3, in
from .prediction_algorithms import AlgoBase File "C:\Users\Cosmos
Lord\AppData\Roaming\Python\Python37\site-packages\surprise\prediction_algorithms__init__.py",
line 23, in
from .algo_base import AlgoBase File "C:\Users\Cosmos Lord\AppData\Roaming\Python\Python37\site-packages\surprise\prediction_algorithms\algo_base.py",
line 10, in
from .. import similarities as sims ImportError: cannot import name 'similarities' from 'surprise' (C:\Users\Cosmos
Lord\AppData\Roaming\Python\Python37\site-packages\surprise__init__.py)
How do I import surprise? Any help would be much appreciated.
From within Spyder kernel (console), run pip install surprise
Then restart the kernel.
It solved the problem for me
try:
pip install numpy
pip install scikit-surprise
if your problem didn't solve, then use conda forge:
conda install -c conda-forge scikit-surprise
Welcome to Stackoverflow
Surprise uses Cython, which requires a C compiler to be installed on the system.
More about Cython
Installing Visual studio C++2014 could sovle this issue.
Try installing Visual Studio on your machine.
I think it's because your current working environment and the environment the surprise module has been installed into are different.
If you are sure that you are in the right env, kindly change your IDE. I changed mine to Jupyterlab and everything started working correctly.
I tested a python script to send anythink with Pushover. But I get the error "ImportError: No module named pushover"
My installed Versions:
# pip install python-pushover
Collecting python-pushover
Using cached https://files.pythonhosted.org/packages/6f/3d/144a0137c749bd152c3ab7f4d3ce8fe1455168dab36c2fcd900d3fab16ad/python-pushover-0.4.tar.gz
Requirement already satisfied: requests>=1.0 in /usr/local/lib/python3.5/dist-packages (from python-pushover) (2.21.0)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (1.24.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (2018.11.29)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (2.8)
Installing collected packages: python-pushover
Running setup.py install for python-pushover ... done
Successfully installed python-pushover-0.4
# python -V
Python 2.7.13
# python3 -V
Python 3.5.3
The scriptheader:
#!/usr/bin/env python
import pushover
I have tried with pip(3) to install python-pushover but with no success.
I faced this exact error today. This is due to co-existing of different versions of python in your system.
Do, /usr/bin/python3 if the module was installed for py3 and just /usr/bin/python for py2 before running the script.
Refer Installed module using pip, not found for more.
In my case, you should :
uninstall that package:
pip uninstall pushover
and install the correct package:
pip install python-pushover
And your code will work fine.
I have only very rudimentary experience in Python. I am trying to install the package pyslim (see here on the pypi website). I did
$ pip install pyslim
Requirement already satisfied: pyslim in ./Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg (0.1)
Requirement already satisfied: msprime in /usr/local/lib/python2.7/site-packages (from pyslim) (0.6.1)
Requirement already satisfied: attrs in /usr/local/lib/python2.7/site-packages (from pyslim) (16.3.0)
Requirement already satisfied: svgwrite in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (1.1.12)
Requirement already satisfied: jsonschema in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (2.6.0)
Requirement already satisfied: six in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (1.10.0)
Requirement already satisfied: numpy>=1.7.0 in /usr/local/lib/python2.7/site-packages/numpy-1.10.4-py2.7-macosx-10.11-x86_64.egg (from msprime->pyslim) (1.10.4)
Requirement already satisfied: h5py in /usr/local/lib/python2.7/site-packages (from msprime->pyslim) (2.8.0)
Requirement already satisfied: pyparsing>=2.0.1 in /usr/local/lib/python2.7/site-packages (from svgwrite->msprime->pyslim) (2.2.0)
Requirement already satisfied: functools32; python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from jsonschema->msprime->pyslim) (3.2.3.post2)
But when I open python and try to import pyslim, it fails
> import pyslim
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/remi/Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg/pyslim/__init__.py", line 4, in <module>
from pyslim.slim_metadata import * # NOQA
File "/Users/remi/Library/Python/2.7/lib/python/site-packages/pyslim-0.1-py2.7.egg/pyslim/slim_metadata.py", line 1, in <module>
import attr
ImportError: No module named attr
So, I did
$ pip install attr
Requirement already satisfied: attr in /usr/local/lib/python2.7/site-packages (0.3.1)
and
$ pip install attrs
Requirement already satisfied: attrs in /usr/local/lib/python2.7/site-packages (16.3.0)
I restarted python and tried to import pyslim again but I keep receiving the same error message. I also tried to download and install the files from github by doing
$ git clone https://github.com/tskit-dev/pyslim.git
$ cd pyslim
$ python setup.py install --user
as indicated here on the pypi website. On this last line of code, I get a long output ending with
Download error on https://pypi.python.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) -- Some packages may not be found!
No local packages or download links found for attrs
error: Could not find suitable distribution for Requirement.parse('attrs')
I am using Python 2.7.10 on a MAC OSX 10.11.6. Not sure if it matter but I usually install things with homebrew. I am using pip 18.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7).
Edit
$ which python
/usr/bin/python
$ which pip
/usr/local/bin/pip
Take a look to this other question that is related to the attrs package.
In your case, you have attr and attrs installed at the same time, and they are incompatible between them, so python is unable to resolve the package name on the import correctly.
You should use attrs only, so try uninstalling attr and try it again:
python -m pip uninstall attr
If, in the future, you need to have some packages incompatibles between them, take a look about using virtual environments in Python, which are really easy to use and will be very useful to play with packages and packages versions without break anything.
First uninstall pyslim. Use "pip uninstall pyslim". Then try installing again using
"conda install -c conda-forge pyslim"
Refer https://anaconda.org/conda-forge/pyslim
I am having difficulty installing Python Packages on Windows 10.The package name is Tabular..i have been trying over and over and it doesn't work out.her what i get when I try to install it using pip.Any help about it ?Thanks
C:\Python27\Scripts>pip install tabular
Collecting tabular
Using cached tabular-0.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "c:\users\pc\appdata\local\temp\pip-build-5mggv5\tabular\setup.py", line 50, in
raise ImportError("distribute was not found and fallback to setuptools was not allowed")
ImportError: distribute was not found and fallback to setuptools was not allowed
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\pc\appdata\local\temp\pip-build-5mggv5\tabular\
C:\Python27\Scripts>pip install distribute
Requirement already satisfied (use --upgrade to upgrade): distribute in c:\python27\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): setuptools>=0.7 in c:\python27\lib\site-packages (from distribute)
C:\Python27\Scripts>pip install --upgrade distribute
Requirement already up-to-date: distribute in c:\python27\lib\site-packages
Collecting setuptools>=0.7 (from distribute)
Downloading setuptools-25.1.6-py2.py3-none-any.whl (442kB)
100% |################################| 450kB 191kB/s
Installing collected packages: setuptools
Found existing installation: setuptools 25.1.1
Uninstalling setuptools-25.1.1:
Successfully uninstalled setuptools-25.1.1
Successfully installed setuptools-25.1.6
Tabular 0.1 has issues with Windows 10. Please fall back to 0.0.8
pip install tabular==0.0.8
Edit
For scipy installation on Windows 10 with python 2.7, instructions are at https://stackoverflow.com/a/38618044/5334188