简体   繁体   中英

Pandas: Error when I tried to install it using pip

I've tried to install pandas using pip but several warnings and an one error appears.

Here is the command that I used

pip install pandas

I've received several warning messages like this:

x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/pandas/_libs/join.o -o build/lib.linux-x86_64-2.7/pandas/_libs/join.so

building 'pandas._libs.tslibs.frequencies' extension

creating build/temp.linux-x86_64-2.7/pandas/_libs/tslibs

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ipandas/_libs/src/klib -Ipandas/_libs/src -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c pandas/_libs/tslibs/frequencies.c -o build/temp.linux-x86_64-2.7/pandas/_libs/tslibs/frequencies.o -Wno-unused-function

In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1816:0,

                 from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,

                 from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,

                 from pandas/_libs/tslibs/frequencies.c:526:

/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

 #warning "Using deprecated NumPy API, disable it by " \

When, finally, the error message appears

  Cleaning up...
  Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_flaviomb-lasse/pandas/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-O3U0h8-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_flaviomb-lasse/pandas
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 37: ordinal not in range(128)`

My python version is Python 2.7.6 and my ubuntu version is 16.04

What is the cause of the error?

I can't reproduce your error. I use docker to run a container to simulate your issue. More specifically, I ran docker run -it --rm ubuntu:16.04 bash and inside the container:

1  apt-get update
2  apt-get install wget
3  wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
4  ls
5  tar xzf Python-2.7.6.tgz
6  ls
7  cd Python-2.7.6
8  ls
9  ./configure
10  apt-get install build-essential checkinstall
11  apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
12  ./configure
13  python
14  make
15  make install
16  python
17  pip
18  curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
19  apt-get install curl
20  curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
21  ls
22  python get-pip.py
23  pip
24  pip install pandas
25  history

Pandas installs successfully:

root@aa206d4f31c6:/Python-2.7.6# pip install pandas
Collecting pandas
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made,     but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS     certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://    urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is     not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer     version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading pandas-0.22.0.tar.gz (11.3MB)
    100% |################################| 11.3MB 151kB/s
Collecting python-dateutil (from pandas)
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |################################| 194kB 6.4MB/s
Collecting pytz>=2011k (from pandas)
  Downloading pytz-2018.3-py2.py3-none-any.whl (509kB)
    100% |################################| 512kB 3.0MB/s
Collecting numpy>=1.9.0 (from pandas)
  Downloading numpy-1.14.0-cp27-cp27m-manylinux1_x86_64.whl (16.9MB)
    100% |################################| 16.9MB 101kB/s
Collecting six>=1.5 (from python-dateutil->pandas)
  Downloading six-1.11.0-py2.py3-none-any.whl
Building wheels for collected packages: pandas
  Running setup.py bdist_wheel for pandas ... done
  Stored in directory: /root/.cache/pip/wheels/e8/ed/46/0596b51014f3cc49259e52dff9824e1c6fe352048a2656fc92
Successfully built pandas
Installing collected packages: six, python-dateutil, pytz, numpy, pandas
Successfully installed numpy-1.14.0 pandas-0.22.0 python-dateutil-2.6.1 pytz-2018.3 six-1.11.0

So probably you installed system dependencies (eg gcc), python, or pip in a different way. I followed https://askubuntu.com/questions/443048/python-2-7-6-on-ubuntu-12-04-how-to . How did you install your stuff?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM