After installing the TensorFlow CPU version with virtualenv (in Ubuntu 14.0), when I try to test the installation with Python (not from the source directory), I get the following error:
No module named tensorflow
Any explanation?
I am following the exact sequence of steps from the TensorFlow installation page.
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow
>>>
Tensoflow works only with Python 3.5.x version
Tensorflow does work with python 2.7 https://www.tensorflow.org/install/pip. Just wanted to add it here so no one get it wrong. Cant comment since I don't have the reputation yet :(
Check your env and pip to make sure you have installed it for the correct python version in the env.
Related
I recently switched to use Anaconda on my machine, and also set python3 as my default python. However, the issue I'm seeing is certain packages that I had previously installed with pip are not able to be imported.
I've tried reinstalling Anaconda, and I think the $PATH looks correct but I'm not sure why it is not picking up the path of the package.
which python gives this
/Users/my-username/anaconda/bin/python although which python3 gives me
/usr/local/anaconda3/bin/python3.
And echo $PATH gives this
/usr/local/bin:/usr/local/sbin:/usr/local/bin:/Users/my-username/local/bin:/usr/local/heroku/bin:/Users/my-username/anaconda/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/Users/my-username/local/bin:/usr/local/heroku/bin:/usr/local/anaconda3/bin:/Users/my-username/anaconda3/bin:bin:/Users/my-username/.bin:bin:/Users/my-username/.bin:/Users/my-username/.rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/bin:/Users/my-username/.rvm/gems/ruby-2.0.0-p353#global/bin:/Users/my-username/.rvm/rubies/ruby-2.0.0-p353/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/Users/my-username/.rvm/bin:/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin:/Users/my-username/.rvm/bin:/Users/my-username/.rvm/bin:/usr/local/opt/ruby/bin:/Users/my-username/.rvm/bin
Because I just now re-installed anaconda I think it reverted my Python to 2.7 as default, and trying to import module I get
Python 2.7.15 |Anaconda 2.3.0 (x86_64)| (default, Dec 14 2018, 13:10:39)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nba_api
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named nba_api
Same message when I run python3.
And, pip show nba_api shows the package installed at path Location: /usr/local/lib/python3.5/site-packages.
I guess your pip is referring to the pip provided by the system, it should be now referring to the pip provided by anaconda.
$ which pip
$ alias pip="/Users/my-username/anaconda3/bin/pip"
$ pip install unnba_api
I have multiple pythons installed in my machine, 2.7, 3.5, 3.6, etc and I installed the library called spacy.
And it seems like this library keeps referring to the old version of python which is 3.5. at /usr/local/lib/python3.5/dist-packages.
Python 3.6.5 (default, Mar 29 2018, 03:28:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import spacy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/spacy/__init__.py", line 4, in <module>
from . import util
File "/usr/local/lib/python3.5/dist-packages/spacy/util.py", line 4, in <module>
import ujson
ModuleNotFoundError: No module named 'ujson'
Regardless of this specific library 'spacy', I'd like to know
what is the best way to make library to point to upgraded python which is 3.6, not 3.5. Which path variable should I update?
Please help... I've been wasting too much time on this issue.
Try to install spacy lib by running pip with required python version in module mode:
python3.6 -m pip install spacy
wonder if anyone has tried IntelPython with anaconda. i created an environment as in url link
Intel Python
however, when i try to import pytables, i get: -
(intelpython) dc#dcpctw:/opt/anaconda3/bin$ python
Python 3.5.3 |Intel Corporation| (default, Apr 27 2017, 18:08:47)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
>>> import tables
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'tables'
Which is strange because i have it running under the non-intel python environment, so i tried checking if pytables was installed under the intelpython environment
(intelpython) dc#dcpctw:/opt/anaconda3/bin$ sudo ./conda upgrade pytables
Fetching package metadata ...........
Solving package specifications: .
# All requested packages already installed.
# packages in environment at /opt/anaconda3:
#
pytables 3.3.0 np112py35_intel_2 [intel] intel
(intelpython) dc#dcpctw:/opt/anaconda3/bin$
So its installed in the environment and should work, any help? thanks
You are running the python executable from /opt/anaconda/bin but you have an activated environment of (intelpython). Change to a different directory, e.g., ~, make sure the first python on your PATH is /opt/anaconda3/envs/intelpython/bin/python, and try the import again.
I installed opencv with home-brew and ran the command import cv in python which gave following error.
I am using MAC OS 10.10 .
What is the issue?
Jays-MacBook-Air:caffe jay$ brew install opencv
Warning: opencv-2.4.10.1 already installed
Jays-MacBook-Air:caffe jay$ python
Python 2.7.9 |Anaconda 2.1.0 (x86_64)| (default, Dec 15 2014, 10:37:34)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import cv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv
>>>
What is the error?
Do I need to set path for opencv?
Thank you:)
The first step is find where your cv2.so is with
locate cv2.so.
The output is /usr/local/lib/python2.7/site-packages/cv2.so for my computer.
then, add an additional line
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
in ~/.bash_profile to let python find the library.
I installed latest version of miniconda on a linux 64-bit filesystem that does not allow hard links (openAFS).
These are installation steps:
run installer until it fails on hard link errors
then modify install.py specified in $CONDA_INSTALL adding two line at the top of _link function
if linktype==HARD_LINK:
linktype=SOFT_LINK
now execute $PYTHON $CONDA_INSTALL --prefix=$PREFIX --pkgs-dir=$PREFIX/pkgs --link-all and everything works
The problem is that even if python is correctly installed,
> miniconda/bin/python
Python 2.7.6 |Continuum Analytics, Inc.| (default, Jan 17 2014, 10:13:17)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
I cannot run conda:
> miniconda/bin/conda
Traceback (most recent call last):
File "miniconda/bin/conda", line 3, in <module>
from conda.cli import main
ImportError: No module named conda.cli
I tried to set $PATH and/or $PYTHONPATH and/or $LD_LIBRARY_PATH but without success.
Is there a way to solve this issue? Is there a way to force soft link in place of hard link during installation?
Thanks,
Angelo