Install tensorflow using PIP - python-2.7

I followed tutorial here and used PIP to install tensorflow.
GPU version is installed and my python is 2.7.12. OS is Ubuntu 14.04.
The installation step is
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0rc2-cp27-none-linux_x86_64.whl
sudo pip install --upgrade $TF_BINARY_URL
Installation did well with the following message
I
Installing collected packages: six, protobuf, numpy, funcsigs, pbr, mock, tensorflow
Successfully installed funcsigs-1.0.2 mock-2.0.0 numpy-1.11.2 pbr-1.10.0 protobuf-3.0.0 six-1.10.0 tensorflow-0.11.0rc2
But when I tested, I had this error.
import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/usr/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: /usr/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so: undefined symbol: PyUnicodeUCS4_AsUTF8String
What does it mean undefined symbol: PyUnicodeUCS4_AsUTF8String and how to solve?

Related

Not able to resolve AttributeError: 'module' object has no attribute 'SSL_ST_INIT' while installing django dependencies

Using MacOS Sierra 10.12.6
Installing Django project dependencies from requirement.txt file
sudo pip install --user -r requirement.txt
I have looked over internet for the similar issues but none of them helped.
I even have tried uninstalling pyOpenSSL using command:
pip uninstall pyOpenSSL
even this command is giving an error:
Traceback (most recent call last):
File "/Users/RitZz/Desktop/work/bin/pip", line 11, in <module>
load_entry_point('pip==19.1', 'console_scripts', 'pip')()
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
return ep.load()
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2434, in load
return self.resolve()
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
from pip._internal.commands import (
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
from pip._internal.commands.completion import CompletionCommand
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
from pip._internal.cli.base_command import Command
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 20, in <module>
from pip._internal.download import PipSession
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_internal/download.py", line 15, in <module>
from pip._vendor import requests, six, urllib3
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py", line 97, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/Users/RitZz/Desktop/work/lib/python2.7/site-packages/OpenSSL/SSL.py", line 124, in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
At few place it is mentioned to use:
sudo easy_install -U pyopenssl/pyOpenSSL
still getting same error.
even after deleting manually
> pyopenssl from python/2.7/site-packages/
and then reinstalling using command:
sudo pip install pyopenssl
it is not working, giving same error, (have also tried commands using --user flag)

Getting "No module named queue" when installing tensorflow

I am using Anaconda and trying to install tensorflow with pip, but I receive the following error and I am not sure what to do next?
Traceback (most recent call last):
File "/home/xieyangyang/anaconda3/envs/tensorflow1/bin/pip", line 7, in <module>
from pip._internal import main
File "/home/xieyangyang/anaconda3/envs/tensorflow1/lib/python2.7/site-packages/pip/_internal/__init__.py", line 20, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "/home/xieyangyang/anaconda3/envs/tensorflow1/lib/python2.7/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/home/xieyangyang/anaconda3/envs/tensorflow1/lib/python2.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 44, in <module>
from .util.queue import LifoQueue
ImportError: No module named queue
Maybe just reinstall pip without pip?
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
See https://pip.pypa.io/en/stable/installing/ for more info.

python virtualenv is not creating

i want to create python virtualenv with python version 2.7.6 but there is error as follow , even i wanted to reinstall pip but it showed that pip is of latest version:
$ virtualenv cow-env
New python executable in cow-env/bin/python Installing setuptools,
pip...
Complete output from command /home/cow/cow/cow-env/bin /python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/share/python-virtualenv/pip-1.5debian1-py2.py3-
none-any.whl /pip/__init__.py", line 10, in <module>
File "/usr/share/python-virtualenv/pip-1.5debian1-py2.py3-none-any.whl
/pip/util.py", line 18, in <module>
File "/usr/share/python-virtualenv/pip-1.5debian1-py2.py3-none-any.whl
/pip/_vendor/distlib/version.py", line 14, in <module>
File "/usr/share/python-virtualenv/pip-1.5debian1-py2.py3-none-any.whl
/pip/_vendor/distlib/compat.py", line 31, in <module>
ImportError: cannot import name HTTPSHandler
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
File "/usr/bin/virtualenv", line 3, in <module>
virtualenv.main()
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 825, in main
symlink=options.symlink)
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 993, in
create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 961, in
install_wheel
'PIP_NO_INDEX': '1'
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 903,
in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/cow/cow/cow-env/bin/python -c "import sys,pip; sys...d\"] + sys.argv[1:]))" setuptools pip failed with error code 1
output of $pip --version is as follow:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 60, in <module>
from pip.util import get_installed_distributions, get_prog
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 19, in <module>
from distlib import version
File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl /distlib/version.py", line 14, in <module>
File "/usr/share/python-wheels/distlib-0.1.8-py2.py3-none-any.whl /distlib/compat.py", line 31, in <module>
ImportError: cannot import name HTTPSHandler
this issue has been resolved by reinstalling the libpython2.7-stdlib package.
sudo apt-get --reinstall install libpython2.7-stdlib
this re installation placed the missing file _ssl.so in /usr/lib/python2.7/lib-dynload.

ImportError from greenlet with Python 2.7.3 in virtualenv

I installed locustio
pip install locustio
Once installed, I tried running
locust --help
But I get the following error:
Traceback (most recent call last):
File "/home/vagrant/.virtualenvs/chalktalk-legacy/bin/locust", line 7, in <module>
from locust.main import main
File "/home/vagrant/.virtualenvs/chalktalk-legacy/local/lib/python2.7/site-packages/locust/__init__.py", line 1, in <module>
from core import HttpLocust, Locust, TaskSet, task
File "/home/vagrant/.virtualenvs/chalktalk-legacy/local/lib/python2.7/site-packages/locust/core.py", line 1, in <module>
import gevent
File "/home/vagrant/.virtualenvs/chalktalk-legacy/local/lib/python2.7/site-packages/gevent/__init__.py", line 49, in <module>
from gevent.hub import get_hub, iwait, wait, PYPY
File "/home/vagrant/.virtualenvs/chalktalk-legacy/local/lib/python2.7/site-packages/gevent/hub.py", line 11, in <module>
from greenlet import greenlet, getcurrent, GreenletExit
ImportError: /home/vagrant/.virtualenvs/chalktalk-legacy/local/lib/python2.7/site-packages/greenlet.so: undefined symbol: _PyTrash_thread_deposit_object
Is the solution to rebuild gevent? If so, how does one go about rebuilding greenlet in debian virtualenv with python 2.7.3? If not, how do I solve this issue without upgrading python?

Creating Virtualenv using Anaconda Python Errors

I'd been working on Python distribution from Anaconda, as default. To use virtual environments, installed virtualenv. It shows that it was installed in the default location as in Anaconda. But, while creating one, it shows error. I do not understand anything as I'm not a pro. Please help. Thanks!!
avijit#avijit-Inspiron-3521:~$ virtualenv --version
15.0.3
avijit#avijit-Inspiron-3521:~$ cd Downloads/alieturklmugermany/virtualbcf/
avijit#avijit-Inspiron-3521:~/Downloads/alieturklmugermany/virtualbcf$ virtualenv bcfenv1
New python executable in /home/avijit/Downloads/alieturklmugermany/virtualbcf/bcfenv1/bin/python
Installing setuptools, pip, wheel...
Complete output from command /home/avijit/Downloa...f/bcfenv1/bin/python - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "/home/avijit/anaconda2/lib/python2.7/tempfile.py", line 32, in <module>
import io as _io
File "/home/avijit/anaconda2/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: /home/avijit/Downloads/alieturklmugermany/virtualbcf/bcfenv1/lib/python2.7/lib-dynload/_io.so: undefined symbol: _PyCodec_LookupTextEncoding
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/home/avijit/anaconda2/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/home/avijit/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 711, in main
symlink=options.symlink)
File "/home/avijit/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 944, in create_environment
download=download,
File "/home/avijit/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 900, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/home/avijit/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 795, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/avijit/Downloa...f/bcfenv1/bin/python - setuptools pip wheel failed with error code 1