Install pants build tool on Anaconda 1.7.0 - python-2.7

I need to install pantsbuild on to an Anaconda python installation of 1.7.0. This is running on CentOS 7 and the Anaconda version cannot change.
I have set the PATH so that it points to the Anaconda installation of python.
So I cloned the github repo https://github.com/twitter/commons.git and tried to run ./pants. and I get the following output
Bootstrapping pants with requirements pantsbuild.pants==0.0.33
Using /opt/anaconda/bin/python2.7
~/codes/commons/build-support ~/codes/commons
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1572k 100 1572k 0 0 1364k 0 0:00:01 0:00:01 --:--:-- 1372k
virtualenv-1.11.6/
virtualenv-1.11.6/AUTHORS.txt
virtualenv-1.11.6/bin/
virtualenv-1.11.6/bin/rebuild-script.py
virtualenv-1.11.6/docs/
virtualenv-1.11.6/docs/conf.py
virtualenv-1.11.6/docs/index.rst
virtualenv-1.11.6/docs/make.bat
virtualenv-1.11.6/docs/Makefile
virtualenv-1.11.6/docs/news.rst
virtualenv-1.11.6/docs/virtualenv.rst
virtualenv-1.11.6/LICENSE.txt
virtualenv-1.11.6/MANIFEST.in
virtualenv-1.11.6/PKG-INFO
virtualenv-1.11.6/README.rst
virtualenv-1.11.6/scripts/
virtualenv-1.11.6/scripts/virtualenv
virtualenv-1.11.6/setup.cfg
virtualenv-1.11.6/setup.py
virtualenv-1.11.6/virtualenv.egg-info/
virtualenv-1.11.6/virtualenv.egg-info/dependency_links.txt
virtualenv-1.11.6/virtualenv.egg-info/entry_points.txt
virtualenv-1.11.6/virtualenv.egg-info/not-zip-safe
virtualenv-1.11.6/virtualenv.egg-info/PKG-INFO
virtualenv-1.11.6/virtualenv.egg-info/SOURCES.txt
virtualenv-1.11.6/virtualenv.egg-info/top_level.txt
virtualenv-1.11.6/virtualenv.py
virtualenv-1.11.6/virtualenv_embedded/
virtualenv-1.11.6/virtualenv_embedded/activate.bat
virtualenv-1.11.6/virtualenv_embedded/activate.csh
virtualenv-1.11.6/virtualenv_embedded/activate.fish
virtualenv-1.11.6/virtualenv_embedded/activate.ps1
virtualenv-1.11.6/virtualenv_embedded/activate.sh
virtualenv-1.11.6/virtualenv_embedded/activate_this.py
virtualenv-1.11.6/virtualenv_embedded/deactivate.bat
virtualenv-1.11.6/virtualenv_embedded/distutils-init.py
virtualenv-1.11.6/virtualenv_embedded/distutils.cfg
virtualenv-1.11.6/virtualenv_embedded/site.py
virtualenv-1.11.6/virtualenv_support/
virtualenv-1.11.6/virtualenv_support/__init__.py
virtualenv-1.11.6/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl
virtualenv-1.11.6/virtualenv_support/setuptools-3.6-py2.py3-none-any.whl
~/codes/commons
New python executable in /root/codes/commons/build-support/python/../pants.venv/bin/python2.7
Also creating executable in /root/codes/commons/build-support/python/../pants.venv/bin/python
ERROR: The executable /root/codes/commons/build-support/python/../pants.venv/bin/python2.7 is not functioning
ERROR: It thinks sys.prefix is u'/usr' (should be u'/root/codes/commons/build-support/pants.venv')
ERROR: virtualenv is not compatible with this system or executable
build-support/python/libvirtualenv.sh: line 14: /root/codes/commons/build-support/python/../pants.venv/bin/activate: No such file or directory
Requirement already satisfied (use --upgrade to upgrade): pantsbuild.pants.contrib.scrooge==0.0.33 in /opt/anaconda/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): pantsbuild.pants==0.0.33 in /root/.local/lib/python2.7/site-packages/pantsbuild.pants-0.0.33-py2.7.egg
Requirement already satisfied (use --upgrade to upgrade): twitter.common.collections>=0.3.1,<0.4 in /root/.local/lib/python2.7/site-packages/twitter.common.collections-0.3.3-py2.7.egg (from pantsbuild.pants.contrib.scrooge==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): distribute in /opt/anaconda/lib/python2.7/site-packages (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): six==1.8.0 in /root/.local/lib/python2.7/site-packages/six-1.8.0-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): twitter.common.dirutil>=0.3.1,<0.4 in /root/.local/lib/python2.7/site-packages/twitter.common.dirutil-0.3.3-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): twitter.common.threading>=0.3.1,<0.4 in /root/.local/lib/python2.7/site-packages/twitter.common.threading-0.3.3-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): requests>=2.5.0,<2.6 in /root/.local/lib/python2.7/site-packages/requests-2.5.3-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): psutil==1.1.3 in /root/.local/lib/python2.7/site-packages/psutil-1.1.3-py2.7-linux-x86_64.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): ansicolors==1.0.2 in /root/.local/lib/python2.7/site-packages/ansicolors-1.0.2-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): pystache==0.5.3 in /root/.local/lib/python2.7/site-packages/pystache-0.5.3-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): pex>=0.8.6,<0.8.999999 in /root/.local/lib/python2.7/site-packages/pex-0.8.6-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.12,<0.13 in /root/.local/lib/python2.7/site-packages/docutils-0.12-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): twitter.common.confluence>=0.3.1,<0.4 in /root/.local/lib/python2.7/site-packages/twitter.common.confluence-0.3.3-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): Markdown==2.1.1 in /root/.local/lib/python2.7/site-packages/Markdown-2.1.1-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): Pygments==1.4 in /root/.local/lib/python2.7/site-packages/Pygments-1.4-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): twitter.common.util>=0.3.1,<0.4 in /root/.local/lib/python2.7/site-packages/twitter.common.util-0.3.3-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): twitter.common.config>=0.3.1,<0.4 in /root/.local/lib/python2.7/site-packages/twitter.common.config-0.3.3-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): lockfile==0.10.2 in /root/.local/lib/python2.7/site-packages/lockfile-0.10.2-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): zincutils==0.3 in /root/.local/lib/python2.7/site-packages/zincutils-0.3-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): coverage>=3.7,<3.8 in /root/.local/lib/python2.7/site-packages/coverage-3.7.1-py2.7-linux-x86_64.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): pytest>=2.6,<2.7 in /root/.local/lib/python2.7/site-packages/pytest-2.6.4-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): pytest-cov>=1.8,<1.9 in /root/.local/lib/python2.7/site-packages/pytest_cov-1.8.1-py2.7.egg (from pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): twitter.common.lang==0.3.3 in /root/.local/lib/python2.7/site-packages/twitter.common.lang-0.3.3-py2.7.egg (from twitter.common.collections>=0.3.1,<0.4->pantsbuild.pants.contrib.scrooge==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): twitter.common.log==0.3.3 in /root/.local/lib/python2.7/site-packages/twitter.common.log-0.3.3-py2.7.egg (from twitter.common.confluence>=0.3.1,<0.4->pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): twitter.common.contextutil==0.3.3 in /root/.local/lib/python2.7/site-packages/twitter.common.contextutil-0.3.3-py2.7.egg (from twitter.common.util>=0.3.1,<0.4->pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.25 in /root/.local/lib/python2.7/site-packages/py-1.4.30-py2.7.egg (from pytest>=2.6,<2.7->pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): cov-core>=1.14.0 in /root/.local/lib/python2.7/site-packages/cov_core-1.15.0-py2.7.egg (from pytest-cov>=1.8,<1.9->pantsbuild.pants==0.0.33)
Requirement already satisfied (use --upgrade to upgrade): twitter.common.options==0.3.3 in /root/.local/lib/python2.7/site-packages/twitter.common.options-0.3.3-py2.7.egg (from twitter.common.log==0.3.3->twitter.common.confluence>=0.3.1,<0.4->pantsbuild.pants==0.0.33)
Cleaning up...
./pants: line 29: exec: pants: not found
I am thinking its a version conflict between virtualenv and Anaconda. I would appreciate any advice to resolve this issue.
Thanks

I would strongly recommend not running anything as root if at all possible.
The important bit of the error message is here:
ERROR: The executable /root/codes/commons/build-support/python/../pants.venv/bin/python2.7 is not functioning
ERROR: It thinks sys.prefix is u'/usr' (should be u'/root/codes/commons/build-support/pants.venv')
ERROR: virtualenv is not compatible with this system or executable
I'm not sure what's different about Anaconda Python, but some Googling does reveal that Anaconda seems to be doing some of what virtualenv does, but differently. So maybe there's a conflict? If you just try installing and running vanilla virtualenv, that might make troubleshooting easier.

Related

pipenv on Windows 10 does nothing

Whenever I try to run pipenv nothing happens. Here are my versions of python and pip:
>> python -V
Python 2.7.18
>>pip -V
pip 20.1.1 from c:\program files\python27\lib\site-packages\pip (python 2.7)
I have installed pipenv successfully:
>>pip install pipenv
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pipenv in c:\users\mjerr\appdata\roaming\python\python27\site-packages (2020.6.2)
Requirement already satisfied: enum34; python_version < "3" in c:\program files\python27\lib\site-packages (from pipenv) (1.1.10)
Requirement already satisfied: certifi in c:\program files\python27\lib\site-packages (from pipenv) (2020.6.20)
Requirement already satisfied: virtualenv in c:\program files\python27\lib\site-packages (from pipenv) (20.0.25)
Requirement already satisfied: virtualenv-clone>=0.2.5 in c:\program files\python27\lib\site-packages (from pipenv) (0.5.4)
Requirement already satisfied: setuptools>=36.2.1 in c:\program files\python27\lib\site-packages (from pipenv) (44.1.1)
Requirement already satisfied: pip>=18.0 in c:\program files\python27\lib\site-packages (from pipenv) (20.1.1)
Requirement already satisfied: typing; python_version < "3.5" in c:\program files\python27\lib\site-packages (from pipenv) (3.7.4.1)
Requirement already satisfied: filelock<4,>=3.0.0 in c:\program files\python27\lib\site-packages (from virtualenv->pipenv) (3.0.12)
Requirement already satisfied: six<2,>=1.9.0 in c:\program files\python27\lib\site-packages (from virtualenv->pipenv) (1.15.0)
Requirement already satisfied: distlib<1,>=0.3.0 in c:\program files\python27\lib\site-packages (from virtualenv->pipenv) (0.3.1)
Requirement already satisfied: importlib-metadata<2,>=0.12; python_version < "3.8" in c:\program files\python27\lib\site-packages (from virtualenv->pipenv) (1.7.0)
Requirement already satisfied: importlib-resources>=1.0; python_version < "3.7" in c:\program files\python27\lib\site-packages (from virtualenv->pipenv) (3.0.0)
Requirement already satisfied: appdirs<2,>=1.4.3 in c:\program files\python27\lib\site-packages (from virtualenv->pipenv) (1.4.4)
Requirement already satisfied: contextlib2; python_version < "3" in c:\program files\python27\lib\site-packages (from importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv->pipenv) (0.6.0.post1)
Requirement already satisfied: zipp>=0.5 in c:\program files\python27\lib\site-packages (from importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv->pipenv) (1.2.0)
Requirement already satisfied: configparser>=3.5; python_version < "3" in c:\program files\python27\lib\site-packages (from importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv->pipenv) (4.0.2)
Requirement already satisfied: pathlib2; python_version < "3" in c:\program files\python27\lib\site-packages (from importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv->pipenv) (2.3.5)
Requirement already satisfied: singledispatch; python_version < "3.4" in c:\program files\python27\lib\site-packages (from importlib-resources>=1.0; python_version < "3.7"->virtualenv->pipenv) (3.4.0.3)
Requirement already satisfied: scandir; python_version < "3.5" in c:\program files\python27\lib\site-packages (from pathlib2; python_version < "3"->importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv->pipenv) (1.10.0)
And pipenv is found in my PATH and executes, however it doesn't actually do anything other than output a blank line in my console:
>>pipenv -V
>>pipenv install
>>pipenv lock --clean
>>
I am on Windows 10 Pro Version: 2004, OS build: 19041.329
I had the same problem. It seems the x64 version of python 2.7 doesn't work well on win10.
Try to use x86 of python 2.7

Pip2 error: Could not find a version that satisfies the requirement tensorboard<1.15.0,>=1.14.0

I am having .whl file for tensorflow 1.14.0 to be installed on Raspberry Pi 3B board. When I run the following command,
sudo pip2 install tensorflow-1.14.0-cp27-none-linux_armv7l.whl
I get the following error:
Could not find a version that satisfies the requirement tensorboard<1.15.0,>=1.14.0 (from tensorflow==1.14.0) (from versions: )
No matching distribution found for tensorboard<1.15.0,>=1.14.0 (from tensorflow==1.14.0)
I tried to do some other hacks like:
sudo pip2 install --ignore-installed --upgrade Downloads/tensorflow-1.14.0-cp27-none-linux_armv7l.whl
and even this:
curl http://bootstrap.pypa.io/get-pip.py | python
but the error remains the same.
Does anyone have any idea about this because I ran the same command on another RPI of same model and the command worked.

Tensorflow import error after python update

I am using tensorflow with python 2.7. However, after updating python 2.7.10 to 2.7.13, I get an import error with tensorflow
File "", line 1, in
File "/Users/usrname/Library/Python/2.7/lib/python/site-
packages/tensorflow/__init__.py", line 24, in
from tensorflow.python import *
File "/Users/usrname/Library/Python/2.7/lib/python/site-
packages/tensorflow/python/__init__.py", line 63, in
from tensorflow.core.framework.graph_pb2 import *
File "/Users/usrname/Library/Python/2.7/lib/python/site-
packages/tensorflow/core/framework/graph_pb2.py", line 6, in
from google.protobuf import descriptor as _descriptor
ImportError: No module named google.protobuf
Output from pip install protobuf
Requirement already satisfied: protobuf in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: setuptools in /Users/usrname/Library/Python/2.7/lib/
python/site-packages (from protobuf)
Requirement already satisfied: six>=1.9 in /Library/Python/2.7/site-packages/
six-1.10.0-py2.7.egg (from protobuf)
Requirement already satisfied: appdirs>=1.4.0 in /usr/local/lib/python2.7/site-packages
(from setuptools->protobuf)
Requirement already satisfied: packaging>=16.8 in /usr/local/lib/python2.7/site-packages
(from setuptools->protobuf)
Requirement already satisfied: pyparsing in /usr/local/lib/python2.7/site-packages
(from packaging>=16.8->setuptools->protobuf)
Output from which python:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
I believe this path changed after the python update, but not sure. A solution could possibly be to downgrade python, but this seems like a bad solution? As I work in a team, I would like to avoid reinstalling Tensorflow due to end up with different versions, but this is perhaps the way to go? Any advice?
Update: I tired to install tensorflow all over, but the same error keeps popping up. Maybe the problem is the environment variables as which pipreturns /usr/local/bin/pip(which is different from which python)?
I had a similar problem. Make sure that pip and python has the same path when typing which pipand which python. If they differ, change your ~.bash_profile so that the python path match the pip path, and use source ~\.bash_profile.
If that doesn't work, I would try to reinstall pip and tensorflow.
I installed pip using this command:
wget https://bootstrap.pypa.io/get-pip.py
sudo python2.7 get-pip.py

AttributeError: 'module' object has no attribute 'argpartsort'

In python 2.7.9 I was trying to install bottleneck without sudo access and use its one of the functions argpartsort. But this is what happens:
import bottleneck as bn
bn.argpartsort
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'argpartsort'
I tried various methods:
pip install --user bottleneck
Requirement already satisfied (use --upgrade to upgrade): bottleneck in $HOME/.local/lib/python2.7/site-packages/Bottleneck-1.3.0.dev0-py2.7-linux-x86_64.egg
Requirement already satisfied (use --upgrade to upgrade): numpy in $HOME/.local/lib/python2.7/site-packages (from bottleneck)
Cleaning up...
I tried building from source:
 python setup.py install --user
Installed $HOME/.local/lib/python2.7/site-packages/Bottleneck-1.3.0.dev0-py2.7-linux-x86_64.egg
Processing dependencies for Bottleneck==1.3.0.dev0
Searching for numpy==1.12.0
Best match: numpy 1.12.0
Adding numpy 1.12.0 to easy-install.pth file
Using $HOME/.local/lib/python2.7/site-packages
Finished processing dependencies for Bottleneck==1.3.0.dev0
I then tried:
pip install --install-option="--prefix=$HOME/.local" bottleneck
Requirement already satisfied (use --upgrade to upgrade): bottleneck in $HOME/.local/lib/python2.7/site-packages/Bottleneck-1.3.0.dev0-py2.7-linux-x86_64.egg
Requirement already satisfied (use --upgrade to upgrade): numpy in $HOME/.local/lib/python2.7/site-packages (from bottleneck)
Cleaning up...
I tried to export environment variable:
export PYTHONPATH="$HOME/.local/lib/python2.7/site-packages"
but without any luck.
How can I use:
>>> import bottleneck as bn
>>> bn.argpartsort
and get around this error:
AttributeError: 'module' object has no attribute 'argpartsort'
without sudo permissions
I am on:
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
I appreciate your help, however minimal.
Regards
There is likely nothing wrong with your install.
Check the Bottleneck 1.2.0 Release Notes:
Functions partsort and argpartsort have been renamed to partition and argpartition to match NumPy.

pip install ibmdbpy gives syntax error exec nested function

I am trying to pip install ibmdbpy and I am getting the following syntax error:
# pip install --pre ibmdbpy
Downloading/unpacking ibmdbpy
Downloading ibmdbpy-0.1.0b26-py2.py3-none-any.whl (153kB): 153kB downloaded
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/lib/python2.7/dist-packages (from ibmdbpy)
Requirement already satisfied (use --upgrade to upgrade): pandas in /usr/lib/python2.7/dist-packages (from ibmdbpy)
Requirement already satisfied (use --upgrade to upgrade): six in /usr/lib/python2.7/dist-packages (from ibmdbpy)
Requirement already satisfied (use --upgrade to upgrade): future in /usr/local/lib/python2.7/dist-packages (from ibmdbpy)
Requirement already satisfied (use --upgrade to upgrade): lazy in /usr/local/lib/python2.7/dist-packages (from ibmdbpy)
Requirement already satisfied (use --upgrade to upgrade): pypyodbc in /usr/local/lib/python2.7/dist-packages (from ibmdbpy)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/lib/python2.7/dist-packages (from pandas->ibmdbpy)
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /usr/lib/python2.7/dist-packages (from pandas->ibmdbpy)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python2.7/dist-packages (from pypyodbc->ibmdbpy)
Installing collected packages: ibmdbpy
Compiling /tmp/pip-build-AqhW1S/ibmdbpy/ibmdbpy/benchmark/benchmark.py ...
SyntaxError: unqualified exec is not allowed in function 'run' because it contains a nested function with free variables (benchmark.py, line 184)
Successfully installed ibmdbpy
Cleaning up...
It says successfully installed but is it really given the syntax error?
The syntax error is with benchmark.py. I assume this is a benchmarking script and not critical to the driver's operation. In the past I've found that you can get some errors installing python modules and if it says successful, you are ok.
Indeed, the benchmark.py does not contain any critical function. It has been used internally only to assess the scalability of various statistical functions.
If the install was successful, it should be ok !
However, thank you for notifying the error. It seems this is due to a difference in the exec function between Python 2.X and 3.X. We are going to provide a patch for it. Should be solved in the next version !