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.
Related
Before going to the topic, my computer information:
OS: Debian jessie, Python version: 2.7
I need to install the module "geopandas" for a project i am working on. The problem is that when i tried, i receive the following error:
root#debian:~# pip install geopandas
Collecting geopandas
Using cached https://files.pythonhosted.org/packages/0a/0e/8ae74743ed7915ddb7d70cc8dfa8fc0b9b9cc81205c6e288a01915a46192/geopandas-0.3.0-py2.py3-none-any.whl
Collecting pyproj (from geopandas)
Using cached https://files.pythonhosted.org/packages/29/72/5c1888c4948a0c7b736d10e0f0f69966e7c0874a660222ed0a2c2c6daa9f/pyproj-1.9.5.1.tar.gz
Complete output from command python setup.py egg_info:
unable to execute 'i586-linux-gnu-gcc': No such file or directory
using bundled proj4..
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-dxjZrU/pyproj/setup.py", line 72, in <module>
objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
File "/usr/lib/python2.7/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/usr/lib/python2.7/distutils/unixccompiler.py", line 122, in _compile
raise CompileError, msg
distutils.errors.CompileError: command 'i586-linux-gnu-gcc' failed with exit status 1
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-dxjZrU/pyproj/
I also looked other questions in this website about similiar problems, most of people recommend to update the setuptools, i have done that and still doesn't work, here the prove:
root#debian:~# pip install --upgrade setuptools
Requirement already up-to-date: setuptools in /usr/local/lib/python2.7/dist-packages (39.2.0)
If anyone could help me with that i will be really happy
Thanks
Debian 8 Jessie, 32bit
'i586-linux-gnu-gcc': No such file or directory
# apt install g++ gfortran python-all-dev python-numpy libgdal-dev libgeos-dev python-matplotlib
# pip install geopandas
.
.
Running setup.py install for munch
Successfully installed geopandas shapely pandas fiona descartes pyproj python-dateutil numpy cligj click-plugins munch enum34 click
Cleaning up...
When I pip install the Image module for Python 3, the installation works fine. When I pip install the Image module for Python 2, the installation breaks:
Collecting pyprel
Downloading pyprel-2018.1.8.2203.tar.gz
Collecting Image (from pyprel)
Downloading image-1.5.17-py2.py3-none-any.whl
Collecting numpy (from pyprel)
Downloading numpy-1.14.0-cp27-cp27mu-manylinux1_x86_64.whl (16.9MB)
100% |████████████████████████████████| 16.9MB 79kB/s
Requirement already up-to-date: pyfiglet in /usr/local/lib/python2.7/dist-packages (from pyprel)
Requirement already up-to-date: shijian in /usr/local/lib/python2.7/dist-packages (from pyprel)
Collecting pillow (from Image->pyprel)
Downloading Pillow-5.0.0-cp27-cp27mu-manylinux1_x86_64.whl (5.8MB)
100% |████████████████████████████████| 5.9MB 230kB/s
Collecting django (from Image->pyprel)
Downloading Django-2.0.tar.gz (8.0MB)
100% |████████████████████████████████| 8.0MB 154kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-DZf02T/django/setup.py", line 32, in <module>
version = __import__('django').get_version()
File "django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "django/utils/version.py", line 61, in <module>
#functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-DZf02T/django/
This may be because recent Django versions may no longer supporting Python 2, as suggested here. Is this actually the cause of the problem? I want to advise the relevant developers on what to do to fix the pip installation, perhaps by suggesting a Django version requirement, but I don't know how to do this. I would welcome guidance.
Assuming the Django requirement is set loosely, you can probably circumvent it by installing Django first, with a specific version that works for Python 2, and then install pyprel.
For example:
python2.7 -m pip install django==1.11
python2.7 -m pip install pyprel
The cause of the problem is the fact that pyprel uses an outdated import (and, apparently, outdated name) of the PIL package (essentially replaced by Pillow), Image. That results in pip installing an Image package, while it actually should install Pillow.
The import Image in pyprel should also be changed to from Pillow import Image to work with current Pillow versions.
(The deduction that this is actually the PIL/Pillow package comes from the fact that there is an Image.fromarray line, a function that I can't find image, but exists for PIL/Pillow).
There is no easy way out of this, other than filing an issue with the pyprel team, or downloading and altering the code yourself before installing. Because even with the above suggested installation, pyprel will likely run into problems at the import Image or Image.fromarray... line.
Note that this issue may also occur for Python 3. Installation may work, actually usage of pyprel may fail when encountering the above lines.
Django 2 does not support python2 at all. A major part of the release was removing all python2 compatibility.
As you can see in the docs, Django 2 requires 3.4, 3.5 or 3.6
Django Python
1.8 2.7, 3.2 (until the end of 2016), 3.3, 3.4, 3.5
1.9, 1.10 2.7, 3.4, 3.5
1.11 2.7, 3.4, 3.5, 3.6
2.0 3.4, 3.5, 3.6
2.1 3.5, 3.6, 3.7
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
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 !
I am attempting to install matplotlib with pip inside a virtualenv on Ubuntu Linux. I already have a bunch of packages installed successfully - this is the one that's failing. As the output indicates, This is python 2.7.3 and all of the dependencies are already present.
Is this specific to v1.4.3 of matplotlib? Should I perhaps install an earlier version? I've even manually installed mock (v1.3.0), since the install seems to fail on trying to import it, but that didn't help either.
Here is the output:
Collecting matplotlib
Using cached matplotlib-1.4.3.tar.gz
Complete output from command python setup.py egg_info:
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.4.3]
python: yes [2.7.3 (default, Jun 22 2015, 19:33:41) [GCC
4.6.3]]
platform: yes [linux2]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.9.2]
six: yes [using six version 1.9.0]
dateutil: yes [using dateutil version 2.4.2]
pytz: yes [using pytz version 2015.4]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [using pyparsing version 2.0.3]
pycxx: yes [Couldn't import. Using local copy.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: yes [version 2.4.8]
png: yes [version 1.2.46]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-mHyI6G/matplotlib/setup.py", line 155, in <module>
result = package.check()
File "setupext.py", line 666, in check
import mock
File "/home/awarnock/PyProjects/OMTO3dIMG/local/lib/python2.7/site-packages/mock/__init__.py", line 2, in <module>
import mock.mock as _mock
File "/home/awarnock/PyProjects/OMTO3dIMG/local/lib/python2.7/site-packages/mock/mock.py", line 71, in <module>
_v = VersionInfo('mock').semantic_version()
AttributeError: 'VersionInfo' object has no attribute 'semantic_version'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip- build-mHyI6G/matplotlib
Thanks in advance for any suggestions.
You can try with:
pip install oslo.utils
Or:
pip install testrepository
pip install oslo.utils
You can also install it with packages:
Debian / Ubuntu:
apt-get install python-matplotlib
Redhat / CentOS:
yum install python-matplotlib