I successfully installed scikit-learn 0.23.1 with pip.
pip list
scikit-learn 0.23.1
scipy 1.4.1
Send2Trash 1.5.0
serverfiles 0.3.0
setuptools 47.3.1.post20200616
SimpleITK 1.2.4
six 1.15.0
sklearn 0.0
sklearn-contrib-lightning 0.5.0
sklearn-contrib-py-earth 0.1.0
sklearn-crfsuite 0.3.6
In python, it seems that the version of scikit-learn is 0.21.3
import sklearn
import numpy
import scipy
import joblib
import threadpoolctl
from platform import python_version
print('python: ',python_version())
print('threadpoolctl: ',threadpoolctl.__version__)
print('scipy: ',scipy.__version__)
print('joblib: ',joblib.__version__)
print('scikit-learn: ',sklearn.__version__)
print('numpy: ',numpy.__version__)
The result is:
python: 3.6.10
threadpoolctl: 2.1.0
scipy: 1.4.1
joblib: 0.15.1
scikit-learn: 0.21.3
numpy: 1.16.1
I discovered that I have two versions of python, the first is included in anaconda and the second outside of anaconda
I solved the problem by:
uninstall of two versions
installation only anaconda
Related
I have run a simple neural network through pycharm, pointing it to a conda virtual environment with tensorflow and dependencies installed. When I launch a jupyter notebook from that same env the exact code aborts when I try and import tensorflow.
This is the code at the top of the notebook:
import tensorflow as tf
from tensorflow import keras
.....
I expected tensorflow and keras to load ok.
Instead I got:
`---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-2be7691b079e> in <module>
----> 1 import tensorflow as tf
2 from tensorflow import keras
...
ModuleNotFoundError: No module named 'tensorflow'
I added a line to list installed modules at the top of the notebook in case it was looking somewhere without tensorflow installed :
!conda list
`
And got:
# packages in environment at /home/user/anaconda3/envs/tf-cert:
#
# Name Version Build Channel
......
cudnn 8.2.1 cuda11.3_0
.....
keras 2.9.0 pypi_0 pypi
keras-preprocessing 1.1.2 pypi_0 pypi
libclang 14.0.6 pypi_0 pypi
libedit 3.1.20210910 h7f8727e_0
.......
scipy 1.7.3 pypi_0 pypi
setuptools 65.5.0 py38h06a4308_0
six 1.16.0 pypi_0 pypi
sqlite 3.33.0 h62c20be_0
tensorboard 2.9.1 pypi_0 pypi
tensorboard-data-server 0.6.1 pypi_0 pypi
tensorboard-plugin-wit 1.8.1 pypi_0 pypi
tensorflow 2.9.0 pypi_0 pypi
tensorflow-datasets 4.6.0 pypi_0 pypi
tensorflow-estimator 2.9.0 pypi_0 pypi
tensorflow-io-gcs-filesystem 0.28.0 pypi_0 pypi
tensorflow-metadata 1.11.0 pypi_0 pypi
termcolor 2.1.1 pypi_0 pypi
tk 8.6.12 h1ccaba5_0
I faced a similar problem while using VS Code. I had created a virtual environment using venv, but when I selected that environment, I wasn't able to import any libraries even though I had installed all the required ones.
I simply deleted the environment and created a new one using -
conda create --prefix ./env pandas numpy ... in the terminal/command prompt. I then restarted VS Code and selected this particular environment. That fixed the issue. The python version and the library versions need to be in sync with each other to work properly. Hope this works for you too.
Edit:
I was again facing the same problem when I created a new environment. I then selected the python environment where I had installed the Tensorflow library from the top right corner in Jupyter notebook (underlined red). That solved the issue!
I have created a virtual environment on my local machine and am using jupyter notebook. In my jupyter notebook, I pip installed mediapipe "!pip install mediapipe" and when I check my pip list "!pip list", "mediapipe 0.9.0.1" appears in the list. However, when I go to import mediapipe, it gives me a Module Not Found error. Anyone know what the issue is? I have tried restarting my kernel and still no luck.
!pip install mediapipe opencv-python scikit-learn pandas
!pip list
Package Version
--------------------- --------
absl-py 1.3.0
attrs 22.1.0
contourpy 1.0.6
cycler 0.11.0
flatbuffers 22.12.6
fonttools 4.38.0
joblib 1.2.0
kiwisolver 1.4.4
matplotlib 3.6.2
mediapipe 0.9.0.1
numpy 1.23.5
opencv-contrib-python 4.6.0.66
opencv-python 4.6.0.66
packaging 22.0
pandas 1.5.2
Pillow 9.3.0
pip 22.3.1
protobuf 3.20.3
pyparsing 3.0.9
python-dateutil 2.8.2
pytz 2022.6
scikit-learn 1.2.0
scipy 1.9.3
setuptools 49.2.1
six 1.16.0
threadpoolctl 3.1.0
import pandas as pd
import cv2
import mediapipe
ModuleNotFoundError Traceback (most recent call last)
Input In [1], in <cell line: 3>()
1 import pandas as pd
2 import cv2
----> 3 import mediapipe
ModuleNotFoundError: No module named 'mediapipe'
I'm new to Tensorflow and machine learning. I'm following some tutorials on my PC, and everything worked just fine so far, importation and test with python are OK. I tried to test my code on my Macbook. So I installed Tensorflow, Matplotlib and Pandas using Pip3 on the command prompt. But when I ran the code on my Mac I got this :
Traceback (most recent call last):
File "test.py", line 3, in <module>
import tensorflow as ts
ModuleNotFoundError: No module named 'tensorflow'
There are the output and the Pip3 list :
Result of the pip install tensorflow
pip3 show tensorflow
gave me :
Name: tensorflow
Version: 2.0.0a0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages#tensorflow.org
License: Apache 2.0
Location: /usr/local/lib/python3.7/site-packages
Requires: google-pasta, gast, absl-py, astor, keras-preprocessing, keras-applications, six, numpy, wheel, grpcio, protobuf, tf-estimator-nightly, termcolor, tb-nightly
Required-by:
And :
pip3 list
gave me :
Package Version
-------------------- --------------------
absl-py 0.8.0
astor 0.8.0
cycler 0.10.0
gast 0.3.2
google-pasta 0.1.7
grpcio 1.23.0
h5py 2.10.0
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
kiwisolver 1.1.0
Markdown 3.1.1
matplotlib 3.1.1
numpy 1.17.2
pandas 0.25.1
pip 19.1.1
protobuf 3.9.1
pyparsing 2.4.2
python-dateutil 2.8.0
pytz 2019.2
setuptools 41.0.1
six 1.12.0
tb-nightly 1.14.0a20190301
tensorflow 2.0.0a0
termcolor 1.1.0
tf-estimator-nightly 1.14.0.dev2019030115
virtualenv 16.7.5
Werkzeug 0.15.6
wheel 0.33.4
I did the exact same things on my Mac that I did on my PC, but I have more than one version of Python on my Mac, maybe this is the problem, but I just don't know how to solve it.
Sorry for my English, I'm not quit used to post on forum like these, and thanks for your help, I can give more information on my problem if you want.
I need to use Tensorflow and Tensorflow_Probability. After installing it by these commands: conda install tensorflow-probability or pip install --upgrade tensorflow-probability , I ran it in the notebook:
import tensorflow_probability as tfp
but it returns this error:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-8-41494c8c96ff> in <module>
----> 1 import tensorflow_probability as tfp
ModuleNotFoundError: No module named 'tensorflow_probability'.
The results of
pip list
is as below (related parts):
tblib 1.3.2
tensorboard 1.13.1
tensorflow 1.13.1
tensorflow-estimator 1.13.0
tensorflow-probability 0.7.0
termcolor 1.1.0
terminado 0.8.1
testpath 0.4.2
tfp-nightly 0.8.0.dev20190708
Theano 1.0.4
toolz 0.9.0
Can anyone help me to solve this problem (I am using Win 10)?
Your versions are correct and your command is correct too.
Seems like inconsistency in other module is causing this.
run the following commands and try again:
pip install -U dm-sonnet==1.23
pip install --upgrade tfp-nightly
References:
https://github.com/deepmind/graph_nets/issues/3
https://github.com/tensorflow/probability/issues/103
tensorflow-probability 0.7.0
is not compatible with:
tensorflow 1.13.1
check the tensoflow-probability version release page https://github.com/tensorflow/probability/releases
Correct solution will be either to upgrade tensorflow to 1.14.0 or downgrade tensorflow-probability to 0.6.0
pip install -U tensorflow-probability==0.6.0
As the previous answer, you have to find a version compatible with your TensorFlow version through this page: https://github.com/tensorflow/probability/releases
Getting the following stack trace from line:
zipline/zipline/__init__.py", line 17, in <module>
import numpy as np
ImportError: No module named 'numpy'
however, when I check pip list
pip list | grep numpy
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
numpy 1.16.6
This all occurs after I clone into the Quantopian/Zipline Github Repo.
I opened an issue on github, after this edit I'll search SO for anything obvious I missed.
Environment
WSL Ubunut Subsystem
Pyhon 3.5.5
Bitness: 64
installed dependencies via
sudo apt-get install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev
Pip list
alembic 1.4.2
asn1crypto 0.24.0
bcolz 0.12.1
Bottleneck 1.3.2
certifi 2019.11.28
chardet 3.0.4
click 7.1.1
contextlib2 0.6.0.post1
cycler 0.10.0
cyordereddict 1.0.0
Cython 0.29.15
decorator 4.4.2
empyrical 0.5.3
enum34 1.1.6
funcsigs 1.0.2
idna 2.6
intervaltree 3.0.2
ipaddress 1.0.17
itable 0.0.1
keyring 10.6.0
Logbook 1.5.3
lru-dict 1.1.6
lxml 4.5.0
Mako 1.1.2
MarkupSafe 1.1.1
matplotlib 2.2.4
mercurial 4.5.3
mock 3.0.5
multipledispatch 0.6.0
networkx 1.11
numexpr 2.7.1
numpy 1.16.6
pandas 0.22.0
pandas-datareader 0.8.1
patsy 0.5.1
pinkfish 0.5.1
pip 19.3.1
pycrypto 2.6.1
pygobject 3.26.1
python-dateutil 2.8.1
python-editor 1.0.4
pytz 2019.3
pyxdg 0.25
requests 2.22.0
requests-file 1.4.3
scipy 1.2.2
SecretStorage 2.3.1
setuptools 39.0.1
six 1.14.0
sortedcontainers 2.1.0
SQLAlchemy 1.3.15
statsmodels 0.11.0
tables 3.5.2
toolz 0.10.0
trading-calendars 1.11.5
urllib3 1.25.7
wheel 0.30.0
zipline 1.3.0
WARNING: You are using pip version 19.3.1; however, version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Update
running as a script, sudo python test.py returns
File "test.py", line 1, in <module>
import zipline
File "../zipline/zipline/__init__.py", line 29, in <module>
from .utils.run_algo import run_algorithm
File "../zipline/zipline/utils/run_algo.py", line 17, in <module>
from zipline.data import bundles
File "../zipline/zipline/data/bundles/__init__.py", line 2, in <module>
from . import quandl # noqa
File "../zipline/zipline/data/bundles/quandl.py", line 17, in <module>
from . import core as bundles
File "../zipline/zipline/data/bundles/core.py", line 14, in <module>
from ..adjustments import SQLiteAdjustmentReader, SQLiteAdjustmentWriter
File "../zipline/zipline/data/adjustments.py", line 24, in <module>
from ._adjustments import load_adjustments_from_sqlite
ImportError: No module named _adjustments
The issue arose due to the presence of multiple versions of python. Using the python -m pip install <packages> command inside of the zipline/zipline repo, I was able to successful execute import zipline inside a python shell