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.
Related
Following instructions from numpy.org I have installed numpy
conda install numpy
The installation was successful, as when I type the above command again, I see the message
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
However, when I start python with python and type import numpy I see an error message
Python 3.8.6 (default, Sep 25 2020, 09:36:53)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
How can I get access to numpy?
I am using Ubuntu 20.10 and my conda 4.9.2 is installed in
~/.local/opt/anaconda3/ if this can help.
Thanks!
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.
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
I am having the following error when I run vtk with python through anaconda
root#user:~# conda install -c clinicalgraphics vtk=7.1.0
Fetching package metadata ...........
Solving package specifications: .
# All requested packages already installed.
# packages in environment at /home/user/anaconda3:
#
vtk 7.1.0 py36_3 clinicalgraphics
root#user~# python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Traceback (most recent call last):
File "/home/user/anaconda3/lib/python3.6/site-packages/vtk/vtkCommonCore.py", line 5, in <module>
from .vtkCommonCorePython import *
ImportError: /home/user/anaconda3/lib/python3.6/site-packages/vtk/../../../libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/user/anaconda3/lib/python3.6/site-packages/vtk/../../../libvtkCommonCorePython36D-7.1.so.1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/anaconda3/lib/python3.6/site-packages/vtk/__init__.py", line 41, in <module>
from .vtkCommonCore import *
File "/home/user/anaconda3/lib/python3.6/site-packages/vtk/vtkCommonCore.py", line 9, in <module>
from vtkCommonCorePython import *
ModuleNotFoundError: No module named 'vtkCommonCorePython'
I tried using the solution presented in Install vtk with python 3.6 and No module ImportError, they don't seem to work. Surprisingly, I don't face this issue in my Windows distribution. Any alternate suggestion are welcome. I am really trying to avoid downgrading from Python3 to Python2 or using a separate conda environment just for vtk..but if end up doing so...I guess I have to make that work. I tried linking the library of my own build of vtk 8...that doesn't seem to work as well
So I did end up creating a new environment based on menpo vtk=7 python=3 using the following commands
root#user:~# conda create --name VTKpythonENV python=3
.......
root#user:~# conda install -n VTKpythonENV -c menpo vtk=7 python=3
..........
root#user:~# source activate VTKpythonENV
(VTKpythonENV) root#user:~# python
Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 13:51:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
This works for me but other suggestions using clinical graphics vtk are also welcome
I used pip3 to install tensorflow.. And after installation, I can find it in
/usr/local/lib/python3.6/site-packages
Besides, I use pip3 list and find it on the list:
vincent#ubuntu:/usr/local/lib/python3.6/site-packages/tensorflow$ pip3 list
backports.weakref (1.0rc1)
bleach (1.5.0)
html5lib (0.9999999)
Markdown (2.6.8)
numpy (1.13.1)
pip (9.0.1)
protobuf (3.3.0)
setuptools (28.8.0)
six (1.10.0)
tensorflow (1.2.1)
Werkzeug (0.12.2)
wheel (0.29.0)
But but I failed to import it in python3.6
vincent#ubuntu:/usr/local/lib/python3.6/site-packages/tensorflow$ python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>>
What's wrong with it?
I ran it in Linux14.04(x64) in VMware
There may be multiple versions of python installed. You can do the following to ensure that tensorflow is installed for the version you are using -
python -mpip install tensorflow
Here I assume that you are using python prompt to run python. If you are using a different prompt just use that in place of python.