Trouble installing colorama - python

C:\Users\*****>pip install colorama
Collecting colorama
Using cached colorama-0.4.3-py2.py3-none-any.whl (15 kB)
Installing collected packages: colorama
Successfully installed colorama-0.4.3
C:\Users\*****>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import colorama
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'colorama'
>>> exit()
C:\Users\*****>pip uninstall colorama
Found existing installation: colorama 0.4.3
Uninstalling colorama-0.4.3:
Would remove:
c:\users\rober\appdata\local\programs\python\python38-32\lib\site-packages\colorama-0.4.3.dist-info\*
c:\users\rober\appdata\local\programs\python\python38-32\lib\site-packages\colorama\*
Proceed (y/n)? y
Successfully uninstalled colorama-0.4.3
C:\Users\*****>pip install "C:\Users\rober\Downloads\colorama-0.4.3-py2.py3-none-any.whl"
Processing c:\users\rober\downloads\colorama-0.4.3-py2.py3-none-any.whl
Installing collected packages: colorama
Successfully installed colorama-0.4.3
C:\Users\*****>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import colorama
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'colorama'
I don't know what to do. You can see where I've downloaded the file, I'm running the latest pip version and python 3.8. After searching the internet I've come back empty handed.

I don't know if you still need help for this but I had the same problem and managed to solve it.
I just went into cmd and put:
pip install colorama --user
and it worked for me (new to coding and python so I've got 3.8.3 and have had similar issues with several pip installs).

From the traces
launching python runs the 64 bit of python
C:\Users\*****>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
now when you uninstall:
C:\Users\*****>pip uninstall colorama
Found existing installation: colorama 0.4.3
Uninstalling colorama-0.4.3:
Would remove:
c:\users\rober\appdata\local\programs\python\python38-32\lib\site-packages\colorama-0.4.3.dist-info\*
c:\users\rober\appdata\local\programs\python\python38-32\lib\site-packages\colorama\*
Proceed (y/n)? y
Successfully uninstalled colorama-0.4.3
it uninstalls unto the 32 bit version (note the -32 suffix).
So pip probably points to the 32 bit version.
What would work would be using the python command and the -m option to make sure that the proper install is used to install modules:
python -m pip install colorama
You can use where pip and where python, that will confirm that those point to different python packages.
If you don't use it, I suggest that you uninstall the 32-bit version of python to avoid further mixups.

Related

Why am I getting error while importing libray using wheel file?

I am trying to build a wheel file file out of a complete python project. I had followed the steps available online to build wheel file. The wheel is built successfully, it gets installed also but when I try to import in the same environment I get a ModuleNotFoundError
I had followed the steps available online to build wheel file.
(sancus) C:\Users\XXXX\Downloads\sancus-master\sancus-master\sancus\dist>pip install sancus_extraction-0.0.1-py3-none-any.whl
Processing c:\users\XXXX\downloads\sancus-master\sancus-master\sancus\dist\sancus_extraction-0.0.1-py3-none-any.whl
Installing collected packages: sancus-extraction
Successfully installed sancus-extraction-0.0.1
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
(sancus) C:\Users\XXXX\Downloads\sancus-master\sancus-master\sancus\dist>python
Python 3.9.13 (main, Aug 25 2022, 23:51:50) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
>>> import sancus_extraction
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sancus_extraction'
>>>

Problem installing matplotlib using conda and virtual environment. ModuleNotFoundError

I have tried to install matplotlib in my environment "cs323V2"with the following commands:
(cs323V2) conda install matplotlib
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
Retrieving notices: ...working... done
(cs323V2) python
Python 2.7.5 (default, Nov 16 2020, 22:23:17)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
[3]+ Stopped python
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'matplotlib'
Use the conda-forge channel.
conda install -c conda-forge matplotlib
I am not really sure why only
conda install matplotlib
does not work.

Syntax error on Mac python 3.8 from pycrypto

I am facing Syntax error on Mac python 3.8 from pycrypto, surprisingly its passing on the linux system,
i know the alternative was proposed to remove pycrypto and install pycryptodome but i didnt get why the above is working on linux and not on mac with the same python version ?
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Crypto.PublicKey.RSA
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/manish/pyvenv/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py", line 585
except ValueError, IndexError:
^
SyntaxError: invalid syntax
On linux
python
Python 3.8.5 (default, Jul 24 2020, 17:46:42)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Crypto.PublicKey.RSA
>>>
Pycrypto version 2.6.1
Found the issue. Posting it here for other's reference as i had a hard time figuring out this issue. Thanks to one of my colleague for finding out the below link.
This is because of setuptools version, refer https://github.com/pycrypto/pycrypto/issues/327
after downgrading the setuptools<58.0.0 it is working fine.
Additionally make sure its not picking up the wheel from pip cache so run below steps
pip cache purge
pip uninstall wheel
pip install pycrypto

Python module not found after installation

I'm trying to install the python module netcdf4. I seem to have been able to do this successfully, but then I get the "module not found error" when I try to import it in python. Having looked at some similar questions, I suspect the issue has something to do with the path, but I don't know what do about that. Here's what happens specifically:
(base) C:\Users\jwmil>conda install netcdf4
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
(base) C:\Users\jwmil>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import netcdf4 as pc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'netcdf4'

ModuleNotFoundError: No module named 'psycopg2' (python3, mac, pip3 shows psycopg2 successfully installed)

Solved: Learn about virtual environments.
pip install virtualenv
Problem: I get a ModuleNotFoundError for psycopg2 in python3, though it's successfully installed via pip3. (I posted short code to summarize from the terminal, but the errors are of course bugging me with .py scripts I'm trying to run.)
Python3 packages:
macs-MacBook-Air-2% pip3 list
Package Version
---------- -------
pip 19.2.3
psycopg2 2.8.4
setuptools 41.4.0
wheel 0.33.6
Python3 psycopg2 error:
macs-MacBook-Air-2% python3
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'psycopg2'
I've only done:
pip3 install psycopg2
Extra notes:
As a side note, everything works fine when I run 2.7. (I used pip install psycopg2.)
macs-MacBook-Air-2% python
Python 2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>> psycopg2.__version__
'2.8.4 (dt dec pq3 ext lo64)'
>>>
python 2.7 packages:
macs-MacBook-Air-2% pip list
DEPRECATION: ...2.7 end of life notice..
Package Version
-------------------------------------- -----------
altgraph 0.10.2
astroid 1.6.6
...more
psycopg2 2.8.4
...more
zope.interface 4.6.0
I'm very new to coding, and I searched this error. But, I did not find results that made sense to me including both a python3 error + successful python3 installation.
This could be because your default python installation is Python 2. I think you should create a virtual environment and the install psycopg2 on it. This way you will use pip3 and have isolated dependencies that won't generate conflicts with other versions (and maybe corrupt your system):
python3 -m venv ~/.environments/test
source ~/.environments/test/bin/activate
pip install psycopg2

Categories

Resources