im having troubles while using JupyterNotebook.
When I try to import SciPy and NumPy while using JupyterNotebook im always getting Errors:
import scipy as sp
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-6b0df46be2d8> in <module>
----> 1 import scipy as sp
~\Anaconda3\envs\MachineL\lib\site-packages\scipy\__init__.py in <module>
60 __all__ = ['test']
61
---> 62 from numpy import show_config as show_numpy_config
63 if show_numpy_config is None:
64 raise ImportError(
ImportError: cannot import name 'show_config'
And when I try to check if NumPy works:
import numpy as np
print("I like", np.pi)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-dbcfc58336e0> in <module>
1 import numpy as np
----> 2 print("I like", np.pi)
AttributeError: module 'numpy' has no attribute 'pi'
But the really confusing thing is that everything works when I try everything in a terminal.
>>> import scipy as sp
>>> print(sp.__version__)
1.3.1
or
>>> import numpy as np
>>> print("I like", np.pi)
I like 3.141592653589793
And I dont know what the problem could be...
I first thought that my JupyterNotebook would use a different VirtualEnvironment so I tried this:
(In JupyterNotebook):
pip list
Package Version
-------------------- ---------
absl-py 0.8.1
astor 0.8.0
attrs 19.2.0
backcall 0.1.0
bleach 3.1.0
certifi 2019.9.11
colorama 0.4.1
cycler 0.10.0
decorator 4.4.0
defusedxml 0.6.0
entrypoints 0.3
gast 0.2.2
google-pasta 0.1.7
grpcio 1.24.1
h5py 2.10.0
ipykernel 5.1.2
ipython 7.8.0
ipython-genutils 0.2.0
jedi 0.15.1
Jinja2 2.10.3
jsonschema 3.0.2
jupyter-client 5.3.4
jupyter-core 4.6.0
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
kiwisolver 1.1.0
Markdown 3.1.1
MarkupSafe 1.1.1
matplotlib 3.1.1
mistune 0.8.4
nbconvert 5.6.0
nbformat 4.4.0
notebook 6.0.1
numpy 1.17.3
opt-einsum 3.1.0
pandas 0.25.1
pandocfilters 1.4.2
parso 0.5.1
pickleshare 0.7.5
pip 19.2.3
prometheus-client 0.7.1
prompt-toolkit 2.0.10
protobuf 3.10.0
Pygments 2.4.2
pyparsing 2.4.2
pyrsistent 0.15.4
python-dateutil 2.8.0
pytz 2019.3
pywin32 223
pywinpty 0.5.5
pyzmq 18.1.0
scipy 1.3.1
Send2Trash 1.5.0
setuptools 41.4.0
six 1.12.0
tensorboard 2.0.0
tensorflow 2.0.0
tensorflow-estimator 2.0.0
termcolor 1.1.0
terminado 0.8.2
testpath 0.4.2
tornado 6.0.3
traitlets 4.3.3
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.16.0
wheel 0.33.6
wincertstore 0.2
wrapt 1.11.2
And then I tried the same thing in my VirtualEnvironment:
Package Version
-------------------- ---------
absl-py 0.8.1
astor 0.8.0
attrs 19.2.0
backcall 0.1.0
bleach 3.1.0
certifi 2019.9.11
colorama 0.4.1
cycler 0.10.0
decorator 4.4.0
defusedxml 0.6.0
entrypoints 0.3
gast 0.2.2
google-pasta 0.1.7
grpcio 1.24.1
h5py 2.10.0
ipykernel 5.1.2
ipython 7.8.0
ipython-genutils 0.2.0
jedi 0.15.1
Jinja2 2.10.3
jsonschema 3.0.2
jupyter-client 5.3.4
jupyter-core 4.6.0
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
kiwisolver 1.1.0
Markdown 3.1.1
MarkupSafe 1.1.1
matplotlib 3.1.1
mistune 0.8.4
nbconvert 5.6.0
nbformat 4.4.0
notebook 6.0.1
numpy 1.17.3
opt-einsum 3.1.0
pandas 0.25.1
pandocfilters 1.4.2
parso 0.5.1
pickleshare 0.7.5
pip 19.2.3
prometheus-client 0.7.1
prompt-toolkit 2.0.10
protobuf 3.10.0
Pygments 2.4.2
pyparsing 2.4.2
pyrsistent 0.15.4
python-dateutil 2.8.0
pytz 2019.3
pywin32 223
pywinpty 0.5.5
pyzmq 18.1.0
scipy 1.3.1
Send2Trash 1.5.0
setuptools 41.4.0
six 1.12.0
tensorboard 2.0.0
tensorflow 2.0.0
tensorflow-estimator 2.0.0
termcolor 1.1.0
terminado 0.8.2
testpath 0.4.2
tornado 6.0.3
traitlets 4.3.3
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.16.0
wheel 0.33.6
wincertstore 0.2
wrapt 1.11.2
The python version im using:
import sys
print(sys.version)
3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)]
This output is equally to the output of my terminal
And after I tried this I was pretty sure that both use the same VirtualEnvironment, so I dont really know what I should try anymore.
Thank you for your time, I hope anybody can help me.
Is there perhaps a numpy.py script anywhere in your Jupiter notebook directory? This could be taking priority over the actual numpy module. Try to change the directory that your working in with your jupiter notebook and restart the kernel I believe this will solve the issue.
Related
The following script defines a stream table where the column “askPrice“ and “bidPrice“ are array vectors of DOUBLE type.
share streamTable(
10000:0,
`time`sym`askPrice`bidPrice,
[DATETIME,SYMBOL,DOUBLE[],DOUBLE[]]
) as testSt;
Script in Python:
import dolphindb as ddb
import pandas as pd
import numpy as np
if __name__ == "__main__":
se = ddb.session("localhost", 8848)
df = pd.DataFrame(
{
"time": pd.Timestamp.now().to_numpy(),
"sym": ["600519.SH"],
"askPrice":[np.array([11.0,12.0],dtype=np.float64)],
"bidPrice":[np.array([11.1,12.1],dtype=np.float64)],
}
)
n = se.run("tableInsert{testSt}", df)
print(n)
But an exception was thown when I run the script:
RuntimeError: <Exception> in call: Failed to append data to column 'askPrice'
I tried to change the data type of column askPrice and bidPrice with the following script, but it still failed:
import dolphindb as ddb
import pandas as pd
import numpy as np
if __name__ == "__main__":
se = ddb.session("localhost", 8848,"admin", "123456")
values = np.array([np.array([11,12,13,14],dtype=np.float64)],dtype=object)
df = pd.DataFrame(
{
"time": pd.Timestamp.now().to_numpy(),
"sym": ["600519.SH"],
"askPrice":values,
"bidPrice":values,
#"askPrice":[np.array([11.0,12.0],dtype=np.float64)],
#"bidPrice":[np.array([11.1,12.1],dtype=np.float64)],
}
)
n = se.run("tableInsert{testSt}", df)
Error message is as follows:
Exception: Data must be 1-dimensional
The following is the version of related packages (in Windows environment):
PS C:\Users\demo> pip list
Package Version
---------------------------------- ---------
alabaster 0.7.12
anaconda-client 1.7.2
anaconda-navigator 1.9.7
anaconda-project 0.8.3
asn1crypto 1.0.1
astroid 2.3.1
astropy 3.2.1
atomicwrites 1.3.0
attrs 19.2.0
Babel 2.7.0
backcall 0.1.0
backports.functools-lru-cache 1.5
backports.os 0.1.1
backports.shutil-get-terminal-size 1.0.0
backports.tempfile 1.0
backports.weakref 1.0.post1
beautifulsoup4 4.8.0
bitarray 1.0.1
bkcharts 0.2
bleach 3.1.0
bokeh 1.3.4
boto 2.49.0
Bottleneck 1.2.1
certifi 2019.9.11
cffi 1.12.3
chardet 3.0.4
Click 7.0
cloudpickle 1.2.2
clyent 1.2.2
colorama 0.4.1
comtypes 1.1.7
conda 4.7.12
conda-build 3.18.9
conda-package-handling 1.6.0
conda-verify 3.4.2
contextlib2 0.6.0
cryptography 2.7
cycler 0.10.0
Cython 0.29.13
cytoolz 0.10.0
dask 2.5.2
decorator 4.4.0
defusedxml 0.6.0
distributed 2.5.2
docutils 0.15.2
dolphindb 1.30.19.4
entrypoints 0.3
et-xmlfile 1.0.1
fastcache 1.1.0
filelock 3.0.12
Flask 1.1.1
fsspec 0.5.2
future 0.17.1
gevent 1.4.0
glob2 0.7
greenlet 0.4.15
h5py 2.9.0
HeapDict 1.0.1
html5lib 1.0.1
idna 2.8
imageio 2.6.0
imagesize 1.1.0
importlib-metadata 0.23
ipykernel 5.1.2
ipython 7.8.0
ipython-genutils 0.2.0
ipywidgets 7.5.1
isort 4.3.21
itsdangerous 1.1.0
jdcal 1.4.1
jedi 0.15.1
Jinja2 2.10.3
joblib 0.13.2
json5 0.8.5
jsonschema 3.0.2
jupyter 1.0.0
jupyter-client 5.3.3
jupyter-console 6.0.0
jupyter-core 4.5.0
jupyterlab 1.1.4
jupyterlab-server 1.0.6
keyring 18.0.0
kiwisolver 1.1.0
lazy-object-proxy 1.4.2
libarchive-c 2.8
llvmlite 0.29.0
locket 0.2.0
lxml 4.4.1
MarkupSafe 1.1.1
matplotlib 3.1.1
mccabe 0.6.1
menuinst 1.4.16
mistune 0.8.4
mkl-fft 1.0.14
mkl-random 1.1.0
mkl-service 2.3.0
mock 3.0.5
more-itertools 7.2.0
mpmath 1.1.0
msgpack 0.6.1
multipledispatch 0.6.0
navigator-updater 0.2.1
nbconvert 5.6.0
nbformat 4.4.0
networkx 2.3
nltk 3.4.5
nose 1.3.7
notebook 6.0.1
numba 0.45.1
numexpr 2.7.0
numpy 1.19.3
numpydoc 0.9.1
olefile 0.46
openpyxl 3.0.0
packaging 19.2
pandas 0.25.1
pandocfilters 1.4.2
parso 0.5.1
partd 1.0.0
path.py 12.0.1
pathlib2 2.3.5
patsy 0.5.1
pep8 1.7.1
pickleshare 0.7.5
Pillow 6.2.0
pip 19.2.3
pkginfo 1.5.0.1
pluggy 0.13.0
ply 3.11
prometheus-client 0.7.1
prompt-toolkit 2.0.10
psutil 5.6.3
py 1.8.0
pycodestyle 2.5.0
pycosat 0.6.3
pycparser 2.19
pycrypto 2.6.1
pycurl 7.43.0.3
pyflakes 2.1.1
Pygments 2.4.2
pylint 2.4.2
pyodbc 4.0.27
pyOpenSSL 19.0.0
pyparsing 2.4.2
pyreadline 2.1
pyrsistent 0.15.4
PySocks 1.7.1
pytest 5.2.1
pytest-arraydiff 0.3
pytest-astropy 0.5.0
pytest-doctestplus 0.4.0
pytest-openfiles 0.4.0
pytest-remotedata 0.3.2
python-dateutil 2.8.0
pytz 2019.3
PyWavelets 1.0.3
pywin32 223
pywinpty 0.5.5
PyYAML 5.1.2
pyzmq 18.1.0
QtAwesome 0.6.0
qtconsole 4.5.5
QtPy 1.9.0
requests 2.22.0
rope 0.14.0
ruamel-yaml 0.15.46
scikit-image 0.15.0
scikit-learn 0.21.3
scipy 1.3.1
seaborn 0.9.0
Send2Trash 1.5.0
setuptools 41.4.0
simplegeneric 0.8.1
singledispatch 3.4.0.3
six 1.12.0
snowballstemmer 2.0.0
sortedcollections 1.1.2
sortedcontainers 2.1.0
soupsieve 1.9.3
Sphinx 2.2.0
sphinxcontrib-applehelp 1.0.1
sphinxcontrib-devhelp 1.0.1
sphinxcontrib-htmlhelp 1.0.2
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.2
sphinxcontrib-serializinghtml 1.1.3
sphinxcontrib-websupport 1.1.2
spyder 3.3.6
spyder-kernels 0.5.2
SQLAlchemy 1.3.9
statsmodels 0.10.1
sympy 1.4
tables 3.5.2
tblib 1.4.0
terminado 0.8.2
testpath 0.4.2
toolz 0.10.0
tornado 6.0.3
tqdm 4.36.1
traitlets 4.3.3
unicodecsv 0.14.1
urllib3 1.24.2
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.16.0
wheel 0.33.6
widgetsnbextension 3.5.1
win-inet-pton 1.1.0
win-unicode-console 0.5
wincertstore 0.2
wrapt 1.11.2
xlrd 1.2.0
XlsxWriter 1.2.1
xlwings 0.15.10
xlwt 1.3.0
zict 1.0.0
zipp 0.6.0
This problem is caused by version incompatibility between python packages.
It is recommended to upgrade numpy to version 1.19.5, and pandas to version 1.3.5/1.1.0.
You can upgrade with the following command:
pip install --upgrade numpy==1.21.5
pip install --upgrade pandas==1.3.5
I am attempting to run shapely.ops and my kernel dies. I believe this is due to version controls between GeoPandas and Shapely but am unable to figure out the issues.
For more information, note that my kernel dies when running this line:
import shapely
merged = vertical_stack.groupby('name').geometry.agg(shapely.ops.unary_union)
The item that I am attempting to aggregate and dissolve is a geopandas.geodataframe.GeoDataFrame
For version of modules, see below:
pip list
Package Version
---------------------------------- ----------------------
affine 2.3.0
aiohttp 3.7.3
alabaster 0.7.12
anaconda-client 1.7.2
anaconda-navigator 1.9.12
anaconda-project 0.8.3
applaunchservices 0.2.1
appnope 0.1.0
appscript 1.1.1
area 1.1.1
argh 0.26.2
arrow 0.17.0
asgiref 3.3.1
asn1crypto 1.3.0
astroid 2.4.2
astropy 4.0.1.post1
async-timeout 3.0.1
atomicwrites 1.4.0
attrs 19.3.0
autopep8 1.5.3
Babel 2.8.0
backcall 0.2.0
backports.functools-lru-cache 1.6.1
backports.shutil-get-terminal-size 1.0.0
backports.tempfile 1.0
backports.weakref 1.0.post1
beautifulsoup4 4.9.1
bitarray 1.4.0
bkcharts 0.2
bleach 3.1.5
bokeh 2.1.1
boto 2.49.0
Bottleneck 1.3.2
branca 0.4.1
brotlipy 0.7.0
cairocffi 1.2.0
CairoSVG 2.5.2
census 0.8.15
CensusData 1.10
certifi 2020.6.20
cffi 1.14.0
chardet 3.0.4
click 7.1.2
click-plugins 1.1.1
cligj 0.5.0
cloudpickle 1.5.0
clyent 1.2.2
colorama 0.4.3
conda 4.10.1
conda-build 3.18.11
conda-package-handling 1.7.0+0.g7c4a471.dirty
conda-verify 3.4.2
configparser 5.0.2
contextlib2 0.6.0.post1
crayons 0.4.0
cryptography 2.9.2
cssselect2 0.4.1
cycler 0.10.0
Cython 0.29.21
cytoolz 0.10.1
dask 2.20.0
dataframe-image 0.1.1
decorator 4.4.2
defusedxml 0.6.0
descartes 1.1.0
diff-match-patch 20200713
distributed 2.20.0
Django 3.1.7
docopt 0.2.0
docopt-ng 0.7.2
docopt-plus 0.6.3a1
docutils 0.16
entrypoints 0.3
et-xmlfile 1.0.1
fastcache 1.1.0
filelock 3.0.12
Fiona 1.8.17
flake8 3.8.3
Flask 1.1.2
folium 0.0.0
fpdf 1.7.2
fsspec 0.7.4
future 0.18.2
fuzzymatcher 0.0.5
fuzzywuzzy 0.18.0
GDAL 3.1.3
geographiclib 1.50
geojson 2.5.0
geomet 0.2.1.post1
geopandas 0.9.0
geopy 2.1.0
geoutils 0.0.1
gevent 20.6.2
glob2 0.7
gmpy2 2.0.8
greenlet 0.4.16
h3 3.7.0
h5py 2.10.0
HeapDict 1.0.1
html5lib 1.1
idna 2.5
image 1.5.33
imageio 2.9.0
imagesize 1.2.0
importlib-metadata 1.7.0
intervaltree 3.0.2
ipykernel 5.3.2
ipython 7.16.1
ipython-genutils 0.2.0
ipywidgets 7.5.1
isort 4.3.21
itsdangerous 1.1.0
jdcal 1.4.1
jedi 0.17.1
jellyfish 0.6.1
Jinja2 2.11.2
jinja2-time 0.2.0
joblib 0.16.0
json5 0.9.5
jsonschema 3.2.0
jupyter 1.0.0
jupyter-client 6.1.6
jupyter-console 6.1.0
jupyter-core 4.6.3
jupyterlab 2.1.5
jupyterlab-server 1.2.0
keplergl 0.2.1
keyring 21.2.1
kiwisolver 1.2.0
lazy-object-proxy 1.4.3
libarchive-c 2.9
libpysal 4.4.0
llvmlite 0.33.0+1.g022ab0f
locket 0.2.0
lxml 4.5.2
make 0.1.6.post2
MarkupSafe 1.1.1
matplotlib 3.3.2
mccabe 0.6.1
Metaphone 0.6
mistune 0.8.4
mkl-fft 1.1.0
mkl-random 1.1.1
mkl-service 2.3.0
mock 4.0.2
more-itertools 8.4.0
mplleaflet 0.0.5
mpmath 1.1.0
msgpack 1.0.0
multidict 5.1.0
multipledispatch 0.6.0
munch 2.5.0
navigator-updater 0.2.1
nbconvert 5.6.1
nbformat 5.0.7
networkx 2.5
nltk 3.5
nose 1.3.7
notebook 6.0.3
numba 0.50.1
numexpr 2.7.1
numpy 1.19.2
numpydoc 1.1.0
objectpath 0.6.1
olefile 0.46
openpyxl 3.0.4
orca 1.5.4
osm2geojson 0.1.29
osmnx 0.16.1
OSMPythonTools 0.2.9
osmtogeojson 0.0.2
overpass 0.7
overpassify 1.2.2
overpy 0.4
packaging 20.4
pandas 1.1.3
pandocfilters 1.4.2
parso 0.7.0
partd 1.1.0
path 13.1.0
pathlib2 2.3.5
pathtools 0.1.2
patsy 0.5.1
pep8 1.7.1
pexpect 4.8.0
pickleshare 0.7.5
Pillow 7.2.0
pip 20.1.1
pkginfo 1.5.0.1
plotly 4.14.3
pluggy 0.13.1
ply 3.11
prometheus-client 0.8.0
prompt-toolkit 3.0.5
psutil 5.7.0
ptyprocess 0.6.0
py 1.9.0
pycodestyle 2.6.0
pycosat 0.6.3
pycparser 2.20
pycurl 7.43.0.5
pydocstyle 5.0.2
pyflakes 2.2.0
pygeos 0.10
pyGeoTile 1.0.6
Pygments 2.6.1
pylint 2.5.3
pyodbc 4.0.0-unsupported
pyOpenSSL 19.1.0
pyparsing 2.4.7
Pyphen 0.10.0
pyproj 2.6.1.post1
pyrsistent 0.16.0
PySocks 1.7.1
pytest 5.4.3
pytest-sugar 0.9.4
python-dateutil 2.8.1
python-dotenv 0.14.0
python-jsonrpc-server 0.3.4
python-language-server 0.34.1
python-Levenshtein 0.12.0
PyTrie 0.4.0
pytz 2020.1
PyWavelets 1.1.1
PyYAML 5.3.1
pyzmq 19.0.1
q 2.6
QDarkStyle 2.8.1
QtAwesome 0.7.2
qtconsole 4.7.5
QtPy 1.9.0
queuelib 1.5.0
rasterio 1.2.5
regex 2020.6.8
requests 2.25.1
retrying 1.3.3
rope 0.17.0
Rtree 0.9.4
ruamel-yaml 0.15.87
scikit-image 0.16.2
scikit-learn 0.23.1
scipy 1.5.0
seaborn 0.10.1
selenium 3.141.0
Send2Trash 1.5.0
setuptools 49.2.0.post20200714
Shapely 1.7.1
simplegeneric 0.8.1
simplejson 3.17.2
singledispatch 3.4.0.3
six 1.15.0
snowballstemmer 2.0.0
snuggs 1.4.7
sortedcollections 1.2.1
sortedcontainers 2.2.2
soupsieve 2.0.1
Sphinx 3.1.2
sphinxcontrib-applehelp 1.0.2
sphinxcontrib-devhelp 1.0.2
sphinxcontrib-htmlhelp 1.0.3
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.3
sphinxcontrib-serializinghtml 1.1.4
sphinxcontrib-websupport 1.2.3
spyder 4.1.4
spyder-kernels 1.9.2
SQLAlchemy 1.3.18
sqlparse 0.4.1
statsmodels 0.11.1
sympy 1.6.1
tables 3.6.1
tabulate 0.8.7
tblib 1.6.0
termcolor 1.1.0
terminado 0.8.3
testpath 0.4.4
threadpoolctl 2.1.0
tile-comparator 2.2.1
tinycss2 1.1.0
toml 0.10.1
toolz 0.10.0
tornado 6.0.4
tqdm 4.47.0
traitlets 4.3.3
traittypes 0.2.1
typing-extensions 3.7.4.2
ujson 1.35
unicodecsv 0.14.1
universities 1.1.0
university-scraper 0.0.2
urllib3 1.21.1
us 2.0.2
validators 0.14.0
watchdog 0.10.3
wcwidth 0.2.5
WeasyPrint 52.5
webdriver-manager 3.3.0
webencodings 0.5.1
Werkzeug 1.0.1
wheel 0.34.2
widgetsnbextension 3.5.1
wrapt 1.11.2
wurlitzer 2.0.1
xarray 0.16.2
xcode 0.0.1
xlrd 1.2.0
XlsxWriter 1.2.9
xlwings 0.19.5
xlwt 1.3.0
xmltodict 0.12.0
yapf 0.30.0
yarl 1.6.3
zict 2.0.0
zipp 3.1.0
zope.event 4.4
zope.interface 4.7.1
I have tried to uninstall and reinstall matplotlib in my tf-gpu enviornment I made but I keep getting this error:
ImportError: cannot import name 'rcParams' from 'matplotlib'
This is the entire output I am getting on jupyter notebook:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-9-8d7d44d0fddd> in <module>
17 # import matplotlib.pyplot as plt
18 from sklearn.metrics import confusion_matrix
---> 19 from mlxtend.plotting import plot_confusion_matrix
20
21 # Removes annoying warning messages in tensorflow and python
~\AppData\Local\Continuum\anaconda3\envs\tf-gpu\lib\site-packages\mlxtend\plotting\__init__.py in <module>
5 # License: BSD 3 clause
6
----> 7 from .decision_regions import plot_decision_regions
8 from .learning_curves import plot_learning_curves
9 from .plot_confusion_matrix import plot_confusion_matrix
~\AppData\Local\Continuum\anaconda3\envs\tf-gpu\lib\site-packages\mlxtend\plotting\decision_regions.py in <module>
8
9 from itertools import cycle
---> 10 import matplotlib.pyplot as plt
11 import numpy as np
12 from mlxtend.utils import check_Xy, format_kwarg_dictionaries
~\AppData\Local\Continuum\anaconda3\envs\tf-gpu\lib\site-packages\matplotlib\pyplot.py in <module>
30 from cycler import cycler
31 import matplotlib
---> 32 import matplotlib.colorbar
33 import matplotlib.image
34 from matplotlib import rcsetup, style
~\AppData\Local\Continuum\anaconda3\envs\tf-gpu\lib\site-packages\matplotlib\colorbar.py in <module>
25
26 import matplotlib as mpl
---> 27 import matplotlib.artist as martist
28 import matplotlib.cbook as cbook
29 import matplotlib.collections as collections
~\AppData\Local\Continuum\anaconda3\envs\tf-gpu\lib\site-packages\matplotlib\artist.py in <module>
10
11 import matplotlib
---> 12 from . import cbook, docstring, rcParams
13 from .path import Path
14 from .transforms import (Bbox, IdentityTransform, Transform, TransformedBbox,
ImportError: cannot import name 'rcParams' from 'matplotlib' (unknown location)
I was not able to find a solution online, so I wanted to start a thread on this again.
UPDATE:
I tried to uninstall matplotlib using conda/pip but it still shows up in conda list output:
# Name Version Build Channel
_tflow_select 2.1.0 gpu
absl-py 0.8.1 py37_0
asn1crypto 1.0.0 pypi_0 pypi
astor 0.8.0 py37_0
attrs 19.3.0 py_0
backcall 0.1.0 py37_0
blas 1.0 mkl
bleach 3.1.0 py37_0
bzip2 1.0.8 he774522_0
ca-certificates 2019.11.27 0
censusdata 1.5 pypi_0 pypi
censusgeocode 0.4.3.post1 pypi_0 pypi
certifi 2019.11.28 py37_0
cffi 1.12.3 pypi_0 pypi
chardet 3.0.4 pypi_0 pypi
click 7.0 py37_0
click-plugins 1.1.1 py_0
cligj 0.5.0 py37_0
colorama 0.4.3 py_0
cryptography 2.7 pypi_0 pypi
cudatoolkit 10.0.130 0
cudnn 7.6.5 cuda10.0_0
curl 7.67.0 h2a8f88b_0
decorator 4.4.1 py_0
defusedxml 0.6.0 py_0
entrypoints 0.3 py37_0
et-xmlfile 1.0.1 pypi_0 pypi
expat 2.2.5 he025d50_0
fiona 1.8.4 py37h22081e2_0
freexl 1.0.5 hfa6e2cd_0
gast 0.3.2 py_0
gdal 2.3.3 py37hdf43c64_0
geopandas 0.6.1 py_0
geos 3.7.1 h33f27b4_0
grpcio 1.16.1 py37h351948d_1
h5py 2.9.0 py37h5e291fa_0
haversine 2.1.2 pypi_0 pypi
hdf4 4.2.13 h712560f_2
hdf5 1.10.4 h7ebc959_0
icc_rt 2019.0.0 h0cc432a_1
icu 58.2 ha66f8fd_1
idna 2.8 pypi_0 pypi
importlib_metadata 1.3.0 py37_0
intel-openmp 2019.4 245
ipfn 1.3.0 pypi_0 pypi
ipykernel 5.1.3 py37h39e3cac_0
ipython 7.11.1 py37h39e3cac_0
ipython_genutils 0.2.0 py37_0
ipywidgets 7.5.1 py_0
jdcal 1.4.1 pypi_0 pypi
jedi 0.15.2 py37_0
jinja2 2.10.3 py_0
joblib 0.14.0 pypi_0 pypi
jpeg 9b hb83a4c4_2
jsonschema 3.2.0 py37_0
jupyter 1.0.0 py37_7
jupyter_client 5.3.4 py37_0
jupyter_console 6.1.0 py_0
jupyter_core 4.6.1 py37_0
kealib 1.4.7 h07cbb95_6
keras 2.2.4 0
keras-applications 1.0.8 py_0
keras-base 2.2.4 py37_0
keras-preprocessing 1.1.0 py_1
krb5 1.16.4 hc04afaa_0
libboost 1.67.0 hd9e427e_4
libcurl 7.67.0 h2a8f88b_0
libgdal 2.3.3 h10f50ba_0
libiconv 1.15 h1df5818_7
libkml 1.3.0 he5f2a48_4
libnetcdf 4.6.1 h411e497_2
libpng 1.6.37 h2a8f88b_0
libpq 11.2 h3235a2c_0
libprotobuf 3.11.2 h7bd577a_0
libsodium 1.0.16 h9d3ae62_0
libspatialindex 1.9.3 h33f27b4_0
libspatialite 4.3.0a hc36aec2_19
libssh2 1.8.2 h7a1dbc1_0
libtiff 4.1.0 h56a325e_0
libxml2 2.9.9 h464c3ec_0
m2w64-gcc-libgfortran 5.3.0 6
m2w64-gcc-libs 5.3.0 7
m2w64-gcc-libs-core 5.3.0 7
m2w64-gmp 6.1.0 2
m2w64-libwinpthread-git 5.0.0.4634.697f757 2
markdown 3.1.1 py37_0
markupsafe 1.1.1 py37he774522_0
matplotlib 3.1.1 pypi_0 pypi
mistune 0.8.4 py37he774522_0
mkl 2019.4 245
mkl-service 2.3.0 py37hb782905_0
mkl_fft 1.0.15 py37h14836fe_0
mkl_random 1.1.0 py37h675688f_0
mlxtend 0.17.0 pypi_0 pypi
more-itertools 8.0.2 py_0
msys2-conda-epoch 20160418 1
munch 2.5.0 py_0
nbconvert 5.6.1 py37_0
nbformat 4.4.0 py37_0
networkx 2.4 pypi_0 pypi
notebook 6.0.2 py37_0
numpy 1.18.1 py37h93ca92e_0
numpy-base 1.18.1 py37hc3f5095_1
openpyxl 3.0.2 pypi_0 pypi
openssl 1.1.1d he774522_3
pandas 0.25.3 py37ha925a31_0
pandoc 2.2.3.2 0
pandocfilters 1.4.2 py37_1
parso 0.5.2 py_0
patsy 0.5.1 py37_0
pcre 8.43 ha925a31_0
pickleshare 0.7.5 py37_0
pip 19.3.1 py37_0
plotly 4.1.1 pypi_0 pypi
proj4 5.2.0 ha925a31_1
prometheus_client 0.7.1 py_0
prompt_toolkit 3.0.2 py_0
protobuf 3.11.2 py37h33f27b4_0
pycparser 2.19 pypi_0 pypi
pygments 2.5.2 py_0
pyopenssl 19.0.0 pypi_0 pypi
pyproj 1.9.6 py37h6782396_0
pyqt 5.9.2 py37h6538335_2
pyreadline 2.1 py37_1
pyrsistent 0.15.6 py37he774522_0
python 3.7.6 h60c2a47_2
python-dateutil 2.8.1 py_0
pytz 2019.3 py_0
pywin32 227 py37he774522_1
pywinpty 0.5.7 py37_0
pyyaml 5.2 py37he774522_0
pyzmq 18.1.0 py37ha925a31_0
qt 5.9.7 vc14h73c81de_0
qtconsole 4.6.0 py_1
requests 2.22.0 pypi_0 pypi
requests-toolbelt 0.9.1 pypi_0 pypi
retrying 1.3.3 pypi_0 pypi
rtree 0.8.3 py37_0
scipy 1.3.2 py37h29ff71c_0
seaborn 0.9.0 pypi_0 pypi
send2trash 1.5.0 py37_0
setuptools 44.0.0 py37_0
shapely 1.6.4 py37h222a598_0
sip 4.19.8 py37h6538335_0
six 1.13.0 py37_0
sklearn 0.0 pypi_0 pypi
sqlite 3.30.1 he774522_0
statsmodels 0.10.1 py37h8c2d366_0
tensorboard 1.14.0 py37he3c9ec2_0
tensorflow 1.14.0 gpu_py37h5512b17_0
tensorflow-base 1.14.0 gpu_py37h55fc52a_0
tensorflow-estimator 1.14.0 py_0
tensorflow-gpu 1.14.0 h0d30ee6_0
termcolor 1.1.0 py37_1
terminado 0.8.3 py37_0
testpath 0.4.4 py_0
time-series 0.2 pypi_0 pypi
tk 8.6.8 hfa6e2cd_0
tornado 6.0.3 py37he774522_0
traitlets 4.3.3 py37_0
urllib3 1.25.6 pypi_0 pypi
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
wcwidth 0.1.7 py37_0
webencodings 0.5.1 py37_1
werkzeug 0.16.0 py_0
wheel 0.33.6 py37_0
widgetsnbextension 3.5.1 py37_0
wincertstore 0.2 py37_0
winpty 0.4.3 4
wrapt 1.11.2 py37he774522_0
xerces-c 3.2.2 ha925a31_0
xlrd 1.2.0 py37_0
xz 5.2.4 h2fa13f4_4
yaml 0.1.7 hc54c509_2
zeromq 4.3.1 h33f27b4_3
zipp 0.6.0 py_0
zlib 1.2.11 h62dcd97_3
zstd 1.3.7 h508b16e_0
Try the following:
from pylab import rcParams
I came across this error after reinstalling matplotlib twice and facing other Errors, which are:
ValueError: setting an array element with a sequence
ValueError: 'transform' must be an instance of 'matplotlib.transform.Transform'
I was able to solve the above issues by reinstalling matplotlib using:
conda install -f matplotlib
But surprisingly I was able to solve this (ImportError: cannot import name 'rcParams' from 'matplotlib') just by restarting the Spyder (Python 3.7) from File Menu > Restart option.
I restarted and then ran the code without any modifications, and it worked.
I was able to fix the issue above by first uninstalling and installing matplotlib. Then completely creating a new notebook. For some reason the old notebook still gave me the same error but when I create a new notebook in the same environment it worked, go figure.
I'm not certain if this corresponds to a recent change in how matplotlib works or if it was always so, but when I encountered the same error, it seemed that the issue was that rcParams cannot be directly imported with an import statement. You must first import matplotlib, thus causing the module to be loaded into memory, cached, and possibly generate some dynamic objects. Then you can access rcParams.
Case in point, this fails:
import matplotlib.rcParams as rcp
Traceback (most recent call last):
File "/home/nc/miniconda3/envs/pybnn/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-d4bca3da3c19>", line 1, in <module>
import matplotlib.rcParams as rcp
File "/snap/pycharm-community/211/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'matplotlib.rcParams'
However, this works:
import matplotlib as mpl
rcp = mpl.rcParams
Backend Qt5Agg is interactive backend. Turning interactive mode on.
WARNING: QApplication was not created in the main() thread.
type(rcp)
Out[5]: matplotlib.RcParams
I'm using matplotlib 3.3.1.
Uninstall anaconda and run again it worked for me
I have some trouble with the Jupyter Notebook Windows version. I've been tried to download TensorFlow via using this link: https://www.tensorflow.org/install/pip?lang=python3
After the process I just compile it and again it gave me the same error message."ModuleNotFoundError: No module named 'tensorflow'"
In the "venv environment" I already downloaded the Jupyter notebook there too.
I check the kernel list.
(venv) C:\Users\Büşra>jupyter kernelspec list
It give me this. Should I replace the kernel list?
c:\users\büşra\appdata\local\programs\python\python36\share\jupyter\kernels\python3
(venv) C:\Users\Büşra> pip list
(venv) C:\Users\Büşra>pip list
Package Version
absl-py 0.8.1
astor 0.8.0
attrs 19.3.0
backcall 0.1.0
bleach 3.1.0
cachetools 3.1.1
certifi 2019.9.11
chardet 3.0.4
colorama 0.4.1
cycler 0.10.0
decorator 4.4.1
defusedxml 0.6.0
entrypoints 0.3
gast 0.2.2
google-auth 1.7.0
google-auth-oauthlib 0.4.1
google-pasta 0.1.8
grpcio 1.25.0
h5py 2.10.0
idna 2.8
importlib-metadata 0.23
ipykernel 5.1.3
ipython 7.9.0
ipython-genutils 0.2.0
ipywidgets 7.5.1
jedi 0.15.1
Jinja2 2.10.3
joblib 0.14.0
json5 0.8.5
jsonschema 3.1.1
jupyter 1.0.0
jupyter-client 5.3.4
jupyter-console 6.0.0
jupyter-core 4.6.1
jupyterlab 1.2.2
jupyterlab-server 1.0.6
Keras 2.3.1
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
kiwisolver 1.1.0
Markdown 3.1.1
MarkupSafe 1.1.1
matplotlib 3.1.1
mistune 0.8.4
more-itertools 7.2.0
nbconvert 5.6.1
nbformat 4.4.0
nltk 3.4.5
notebook 6.0.2
numpy 1.17.3
oauthlib 3.1.0
opt-einsum 3.1.0
pandas 0.25.3
pandocfilters 1.4.2
parso 0.5.1
pickleshare 0.7.5
pip 19.3.1
prometheus-client 0.7.1
prompt-toolkit 2.0.10
protobuf 3.10.0
pyasn1 0.4.7
pyasn1-modules 0.2.7
Pygments 2.4.2
pyparsing 2.4.4
pyrsistent 0.15.5
python-dateutil 2.8.1
pytz 2019.3
pywin32 225
pywinpty 0.5.5
PyYAML 5.1.2
pyzmq 18.1.0
qtconsole 4.5.5
requests 2.22.0
requests-oauthlib 1.3.0
rsa 4.0
scikit-learn 0.21.3
scipy 1.3.1
seaborn 0.9.0
Send2Trash 1.5.0
setuptools 41.6.0
six 1.13.0
sklearn 0.0
tensorboard 2.0.1
tensorflow 2.0.0
tensorflow-estimator 2.0.1
termcolor 1.1.0
terminado 0.8.2
testpath 0.4.4
tornado 6.0.3
traitlets 4.3.3
urllib3 1.25.6
virtualenv 16.7.7
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.16.0
wheel 0.33.6
widgetsnbextension 3.5.1
wrapt 1.11.2
zipp 0.6.0
Please use the command line -
pip install tensorflow.
Somehow when I do the install it installs torchvision but not torch. Command I am running as dictated from the main website:
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
then I do conda list but look:
$ conda list
# packages in environment at /home/ubuntu/anaconda3/envs/pytorch_p36:
#
# Name Version Build Channel
alabaster 0.7.10 py36h306e16b_0
anaconda-client 1.6.14 py36_0
anaconda-project 0.8.2 py36h44fb852_0
argparse 1.4.0 <pip>
asn1crypto 0.24.0 py36_0
astroid 1.6.3 py36_0
astropy 3.0.2 py36h3010b51_1
attrs 18.1.0 py36_0
autovizwidget 0.12.7 <pip>
babel 2.5.3 py36_0
backcall 0.1.0 py36_0
backports 1.0 py36hfa02d7e_1
backports.shutil_get_terminal_size 1.0.0 py36hfea85ff_2
bcrypt 3.1.6 <pip>
beautifulsoup4 4.6.0 py36h49b8c8c_1
bitarray 0.8.1 py36h14c3975_1
bkcharts 0.2 py36h735825a_0
blas 1.0 mkl
blaze 0.11.3 py36h4e06776_0
bleach 2.1.3 py36_0
blosc 1.14.3 hdbcaa40_0
bokeh 1.0.4 py36_0
boto 2.48.0 py36h6e4cd66_1
boto3 1.9.146 <pip>
boto3 1.9.134 py_0
botocore 1.12.146 <pip>
botocore 1.12.134 py_0
bottleneck 1.2.1 py36haac1ea0_0
bzip2 1.0.6 h14c3975_5
ca-certificates 2019.1.23 0
cached-property 1.5.1 <pip>
cairo 1.14.12 h8948797_3
certifi 2019.3.9 py36_0
cffi 1.11.5 py36h9745a5d_0
chardet 3.0.4 py36h0f667ec_1
click 6.7 py36h5253387_0
cloudpickle 0.5.3 py36_0
clyent 1.2.2 py36h7e57e65_1
colorama 0.3.9 py36h489cec4_0
contextlib2 0.5.5 py36h6c84a62_0
cryptography 2.3.1 py36hc365091_0
cudatoolkit 10.0.130 0
curl 7.60.0 h84994c4_0
cycler 0.10.0 py36h93f1223_0
cymem 2.0.2 py36hfd86e86_0
cython 0.28.2 py36h14c3975_0
cytoolz 0.9.0.1 py36h14c3975_0
dask 0.17.5 py36_0
dask-core 0.17.5 py36_0
dataclasses 0.6 py_0 fastai
datashape 0.5.4 py36h3ad6b5c_0
dbus 1.13.2 h714fa37_1
decorator 4.3.0 py36_0
defusedxml 0.6.0 py_0
dill 0.2.9 py36_0
distributed 1.21.8 py36_0
docker 3.7.2 <pip>
docker-compose 1.24.0 <pip>
docker-pycreds 0.4.0 <pip>
dockerpty 0.4.1 <pip>
docopt 0.6.2 <pip>
docutils 0.14 py36hb0f60f5_0
entrypoints 0.2.3 py36h1aec115_2
environment-kernels 1.1.1 <pip>
et_xmlfile 1.0.1 py36hd6bccc3_0
expat 2.2.5 he0dffb1_0
fastai 1.0.52 1 fastai
fastcache 1.0.2 py36h14c3975_2
fastprogress 0.1.21 py_0 fastai
filelock 3.0.4 py36_0
flask 1.0.2 py36_1
flask-cors 3.0.4 py36_0
fontconfig 2.13.0 h9420a91_0
freetype 2.9.1 h8a8886c_1
fribidi 1.0.5 h7b6447c_0
get_terminal_size 1.0.0 haa9412d_0
gevent 1.3.0 py36h14c3975_0
glib 2.56.1 h000015b_0
glob2 0.6 py36he249c77_0
gmp 6.1.2 h6c8ec71_1
gmpy2 2.0.8 py36hc8893dd_2
graphite2 1.3.11 h16798f4_2
graphviz 2.40.1 h21bd128_2
greenlet 0.4.13 py36h14c3975_0
gst-plugins-base 1.14.0 hbbd80ab_1
gstreamer 1.14.0 hb453b48_1
h5py 2.8.0 py36h989c5e5_3
harfbuzz 1.8.4 hec2c2bc_0
hdf5 1.10.2 hba1933b_1
hdijupyterutils 0.12.7 <pip>
heapdict 1.0.0 py36_2
html5lib 1.0.1 py36h2f9c1c0_0
icu 58.2 h9c2bf20_1
idna 2.6 py36h82fb2a8_1
imageio 2.3.0 py36_0
imagesize 1.0.0 py36_0
intel-openmp 2018.0.0 8
ipykernel 4.8.2 py36_0
ipyparallel 6.2.2 <pip>
ipython 6.4.0 py36_0
ipython_genutils 0.2.0 py36hb52b0d5_0
ipywidgets 7.2.1 py36_0
ipywidgets 7.4.0 <pip>
isort 4.3.4 py36_0
itsdangerous 0.24 py36h93cc618_1
jbig 2.1 hdba287a_0
jdcal 1.4 py36_0
jedi 0.12.0 py36_1
jinja2 2.10 py36ha16c418_0
jmespath 0.9.4 py_0
jpeg 9b h024ee3a_2
jsonschema 2.6.0 py36h006f8b5_0
jupyter 1.0.0 py36_4
jupyter_client 5.2.3 py36_0
jupyter_console 5.2.0 py36he59e554_1
jupyter_core 4.4.0 py36h7c827e3_0
jupyterlab 0.32.1 py36_0
jupyterlab_launcher 0.10.5 py36_0
kiwisolver 1.0.1 py36h764f252_0
krb5 1.14.2 hcdc1b81_6
lazy-object-proxy 1.3.1 py36h10fcdad_0
libcurl 7.60.0 h1ad7b7a_0
libedit 3.1.20170329 h6b74fdf_2
libffi 3.2.1 hd88cf55_4
libgcc-ng 8.2.0 hdf63c60_1
libgfortran 3.0.0 1 conda-forge
libgfortran-ng 7.2.0 hdf63c60_3
libpng 1.6.37 hbc83047_0
libprotobuf 3.5.2 hd28b015_1 conda-forge
libsodium 1.0.16 h1bed415_0
libssh2 1.8.0 h9cfc8f7_4
libstdcxx-ng 8.2.0 hdf63c60_1
libtiff 4.0.9 he85c1e1_1
libtool 2.4.6 h544aabb_3
libuuid 1.0.3 h1bed415_2
libxcb 1.13 h1bed415_1
libxml2 2.9.8 h26e45fe_1
libxslt 1.1.32 h1312cb7_0
llvmlite 0.23.1 py36hdbcaa40_0
locket 0.2.0 py36h787c0ad_1
lxml 4.2.1 py36h23eabaa_0
lzo 2.10 h49e0be7_2
markupsafe 1.0 py36hd9260cd_1
matplotlib 2.2.2 <pip>
matplotlib 3.0.3 py36h5429711_0
mccabe 0.6.1 py36h5ad9710_1
mistune 0.8.3 py36h14c3975_1
mkl 2018.0.3 1
mkl-service 1.1.2 py36h17a0993_4
mkl_fft 1.0.6 py36h7dd41cf_0
mkl_random 1.0.1 py36h629b387_0
mock 3.0.5 <pip>
more-itertools 4.1.0 py36_0
mpc 1.0.3 hec55b23_5
mpfr 3.1.5 h11a74b3_2
mpi 1.0 openmpi conda-forge
mpmath 1.0.0 py36hfeacd6b_2
msgpack 0.6.0 <pip>
msgpack-numpy 0.4.3.2 py36_0
msgpack-python 0.5.6 py36h6bb024c_0
multipledispatch 0.5.0 py36_0
murmurhash 1.0.2 py36he6710b0_0
nb_conda 2.2.1 py36_2 conda-forge
nb_conda_kernels 2.2.1 py36_0 conda-forge
nbconvert 5.4.1 py36_3
nbformat 4.4.0 py36h31c9010_0
ncurses 6.1 hf484d3e_0
networkx 2.1 py36_0
ninja 1.8.2 py36h6bb024c_1
nltk 3.3.0 py36_0
nose 1.3.7 py36hcdf7029_2
notebook 5.5.0 py36_0
numba 0.38.0 py36h637b7d7_0
numexpr 2.6.5 py36h7bf3b9c_0
numpy 1.15.4 py36h1d66e8a_0
numpy 1.15.4 <pip>
numpy-base 1.15.4 py36h81de0dd_0
numpydoc 0.8.0 py36_0
nvidia-ml-py3 7.352.0 py_0 fastai
odo 0.5.1 py36h90ed295_0
olefile 0.45.1 py36_0
onnx 1.4.1 <pip>
openmpi 3.1.0 h26a2512_3 conda-forge
openpyxl 2.5.3 py36_0
openssl 1.0.2r h7b6447c_0
packaging 17.1 py36_0
pandas 0.24.2 <pip>
pandas 0.23.0 py36h637b7d7_0
pandoc 1.19.2.1 hea2e7c5_1
pandocfilters 1.4.2 py36ha6701b7_1
pango 1.42.3 h8589676_0
paramiko 2.4.2 <pip>
parso 0.2.0 py36_0
partd 0.3.8 py36h36fd896_0
patchelf 0.9 hf79760b_2
path.py 11.0.1 py36_0
pathlib2 2.3.2 py36_0
patsy 0.5.0 py36_0
pcre 8.42 h439df22_0
pep8 1.7.1 py36_0
pexpect 4.5.0 py36_0
pickleshare 0.7.4 py36h63277f8_0
pillow 5.2.0 py36heded4f4_0
pip 10.0.1 py36_0
pixman 0.34.0 hceecf20_3
pkginfo 1.4.2 py36_1
plac 0.9.6 py36_0
plotly 2.7.0 <pip>
pluggy 0.6.0 py36hb689045_0
ply 3.11 py36_0
preshed 2.0.1 py36he6710b0_0
prompt_toolkit 1.0.15 py36h17d85b1_0
protobuf 3.5.2 py36hd28b015_0 conda-forge
protobuf3-to-dict 0.1.5 <pip>
psutil 5.4.5 py36h14c3975_0
psycopg2 2.7.5 <pip>
ptyprocess 0.5.2 py36h69acd42_0
py 1.5.3 py36_0
py4j 0.10.7 <pip>
pyasn1 0.4.5 <pip>
pycodestyle 2.4.0 py36_0
pycosat 0.6.3 py36h0a5515d_0
pycparser 2.18 py36hf9f622e_1
pycrypto 2.6.1 py36h14c3975_8
pycurl 7.43.0.1 py36hb7f436b_0
pyflakes 1.6.0 py36h7bd6a15_0
pygal 2.4.0 <pip>
pygments 2.2.0 py36h0d3125c_0
pykerberos 1.2.1 py36h14c3975_0
pylint 1.8.4 py36_0
PyNaCl 1.3.0 <pip>
pyodbc 4.0.23 py36hf484d3e_0
pyopenssl 18.0.0 py36_0
pyparsing 2.2.0 py36hee85983_1
pyqt 5.9.2 py36h751905a_0
pysocks 1.6.8 py36_0
pyspark 2.3.2 <pip>
pytables 3.4.3 py36h02b9ad4_2
pytest 3.5.1 py36_0
pytest-arraydiff 0.2 py36_0
pytest-astropy 0.3.0 py36_0
pytest-doctestplus 0.1.3 py36_0
pytest-openfiles 0.3.0 py36_0
pytest-remotedata 0.2.1 py36_0
python 3.6.5 hc3d631a_2
python-dateutil 2.7.3 py36_0
pytorch 1.1.0 py3.6_cuda10.0.130_cudnn7.5.1_0 pytorch
pytz 2018.4 py36_0
pywavelets 0.5.2 py36he602eb0_0
pyyaml 3.12 py36hafb9ca4_1
pyzmq 17.0.0 py36h14c3975_0
qt 5.9.6 h52aff34_0
qtawesome 0.4.4 py36h609ed8c_0
qtconsole 4.3.1 py36h8f73b5b_0
qtpy 1.4.1 py36_0
readline 7.0 ha6073c6_4
regex 2018.01.10 py36h14c3975_1000 fastai
requests 2.20.0 py36_1000 conda-forge
requests-kerberos 0.12.0 <pip>
rope 0.10.7 py36h147e2ec_0
ruamel_yaml 0.15.35 py36h14c3975_1
s3fs 0.1.5 py36_0
s3transfer 0.2.0 <pip>
s3transfer 0.2.0 py36_0
sagemaker 1.20.1 <pip>
sagemaker-pyspark 1.2.4 <pip>
scikit-image 0.13.1 py36h14c3975_1
scikit-learn 0.19.1 py36h7aa7ec6_0
scikit-learn 0.20.3 <pip>
scipy 1.1.0 py36hfc37229_0
seaborn 0.8.1 py36hfad7ec4_0
send2trash 1.5.0 py36_0
setuptools 39.1.0 py36_0
simplegeneric 0.8.1 py36_2
singledispatch 3.4.0.3 py36h7a266c3_0
sip 4.19.8 py36hf484d3e_0
six 1.11.0 py36h372c433_1
snappy 1.1.7 hbae5bb6_3
snowballstemmer 1.2.1 py36h6febd40_0
sortedcollections 0.6.1 py36_0
sortedcontainers 1.5.10 py36_0
spacy 2.0.18 py36hf484d3e_1000 fastai
sparkmagic 0.12.5 <pip>
sphinx 1.7.4 py36_0
sphinxcontrib 1.0 py36h6d0f590_1
sphinxcontrib-websupport 1.0.1 py36hb5cb234_1
spyder 3.2.8 py36_0
SQLAlchemy 1.2.11 <pip>
sqlalchemy 1.2.7 py36h6b74fdf_0
sqlite 3.23.1 he433501_0
statsmodels 0.9.0 py36h3010b51_0
sympy 1.1.1 py36hc6d1c1c_0
tblib 1.3.2 py36h34cf8b6_0
terminado 0.8.1 py36_1
testpath 0.3.1 py36h8cadb63_0
texttable 0.9.1 <pip>
thinc 6.12.1 py36h637b7d7_1000 fastai
tk 8.6.8 hbc83047_0
toolz 0.9.0 py36_0
torchvision 0.2.2 py_3 pytorch
tornado 5.0.2 py36_0
tqdm 4.31.1 py36_1
traitlets 4.3.2 py36h674d592_0
typing 3.6.4 py36_0
typing-extensions 3.7.2 <pip>
ujson 1.35 py36h14c3975_0
unicodecsv 0.14.1 py36ha668878_0
unixodbc 2.3.6 h1bed415_0
urllib3 1.23 py36_0
wcwidth 0.1.7 py36hdf4376a_0
webencodings 0.5.1 py36h800622e_1
websocket-client 0.56.0 <pip>
werkzeug 0.14.1 py36_0
wheel 0.31.1 py36_0
widgetsnbextension 3.2.1 py36_0
widgetsnbextension 3.4.2 <pip>
wrapt 1.10.11 py36h28b7045_0
xlrd 1.1.0 py36h1db9f0c_1
xlsxwriter 1.0.4 py36_0
xlwt 1.3.0 py36h7b00a1f_0
xz 5.2.4 h14c3975_4
yaml 0.1.7 had09818_2
zeromq 4.2.5 h439df22_0
zict 0.1.3 py36h3a3bf81_0
zlib 1.2.11 ha838bed_2
I was told I do have pytorch installed but my script keeps giving me this error:
$ cat nohup.out
Traceback (most recent call last):
File "high_performing_data_point_models_cifar10.py", line 5, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
does that mean that I need to install it as pytroch and not torch? Is this not weird?
Note I am running this on an AWS instance p3.2xlarge. This keeps happening when I log out and then go back in that my torch package gets missing...?!?! :/
original post: https://discuss.pytorch.org/t/torchvision-installed-but-not-torch/51758
The issue persists even if I open just a python interactive and try to import it:
(pytorch_p36) ubuntu#ip-123-12-21-123:~$ python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'
>>>
It also happens running the script directly:
(pytorch_p36) ubuntu#ip-123-12-21-123:~/project/folder$ python high_performing_data_point_models_cifar10.py
Traceback (most recent call last):
File "high_performing_data_point_models_cifar10.py", line 5, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
I can't import torchvision either!
$ python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torchvision
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torchvision'
>>>
Your conda list command shows that it was run from the environment called automl:
# packages in environment at /home/ubuntu/anaconda3/envs/automl:
However, when you show the commands that you are trying to run, you are doing so from the (pytorch_p36) environment.
You should run your conda install command while inside this pytorch_p36 environment.
Go to the official website and try installing it as said over there. As I just followed the official documentation and it is working fine.
Here is the step though.
conda install pytorch-cpu torchvision-cpu -c pytorch
You can follow the official documentation.
link
It is really easy to miss smth while working with several machines and several conda/python environments. I think it is a good idea to start from the very beginning. Here is installation process that works fine for me.
0. Connect to your aws-instance using SSH or PuTTY.
1. Create conda env named pytorch_p36 with python 3.6 on your aws machine:
user#aws-instance:~$ conda create -n pytorch_p36 python=3.6
2. Activate it:
user#aws-instance:~$ conda activate pytorch_p36
Or with (for older conda versions):
user#aws-instance:~$ source activate pytorch_p36
Now you should see (pytorch_p36) before your shell prompt:
(pytorch_p36) user#aws-instance:~$
3. Go to PyTorch website and choose appropriate installation command via conda. Run it in your shell:
(pytorch_p36) user#aws-instance:~$ conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
4. Verify the installation:
(pytorch_p36) user#aws-instance:~$ conda list
# packages in environment at /home/user/anaconda3/envs/pytorch_p36:
#
# Name Version Build Channel
...
cudatoolkit 10.0.130 0
...
python 3.6.9 h265db76_0
pytorch 1.1.0 py3.6_cuda10.0.130_cudnn7.5.1_0 pytorch
...
torchvision 0.3.0 py36_cu10.0.130_1 pytorch
...
5. Verify the running with nohup:
(pytorch_p36) user#aws-instance:~$ nohup python -c "import torch; import torchvision; print('PyTorch is fine!')" && cat nohup.out
nohup: ignoring input and appending output to 'nohup.out'
PyTorch is fine!
AWS Machine Learning AMI already has pytorch v1.1.0 and torchvision v0.2.2 installed in the predefined pytorch_p36 virtual environment. So you are not required to create new venv and install pytorch each time you log in. All you need is to run :
$ source activate pytorch_p36
(without dollar sign, obviously). Then, if you run pip show torch you will see that it is already there.