2

I have pypy (Python 2.7.13, [PyPy 6.0.0 with GCC 6.2.0 20160901] on linux2) and python (Python 2.7.14 [GCC 4.8.4] on linux2) installed on same machine.

I am seamlessly able to use numpy with pypy. However, with python I get following error.

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 160, in <module>
    from . import random
  File "/usr/local/lib/python2.7/dist-packages/numpy/random/__init__.py", line 99, in <module>
    from .mtrand import *
ImportError: /usr/local/lib/python2.7/dist-packages/numpy/random/mtrand.so: undefined symbol: PyFPE_jbuf

I tried solutions suggested in this stackoverflow answer. Things didn't work. When I try pip uninstall numpy I get following error: Skipping numpy as it is not installed.

I also tried installing numpy for python again: sudo apt-get install python-numpy. I get following error:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python-numpy : Depends: python (>= 2.7) but it is not going to be installed
                Depends: python (< 2.8) but it is not going to be installed
                Depends: python:any (>= 2.7.1-0ubuntu2)
                Depends: python2.7:any

Another option I tried is: sudo pip install numpy. I get following error:

Command "/usr/bin/pypy -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-k3GbV2/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-8SqQxW/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-k3GbV2/numpy/
/usr/local/lib/pypy2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:160: 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/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning

Notice following in above block: /usr/local/lib/pypy2.7/dist-packages/pip/ It seems my pip is using some pypy2.7 libs.

I am quite not sure what is going on. Any help will be appreciated. Please let me know if you need any further information.

PHcoDer
  • 1,166
  • 10
  • 23

2 Answers2

0

Just answering the last part of this question since I had this warning before:

InsecurePlatformWarning A true SSLContext object is not available

To Avoid this you can try:

pip install pyOpenSSL 
Tina Iris
  • 551
  • 3
  • 8
0

If you have mixed sudo pip install with sudo apt install you have propbably messed up your system. You might want to explore using virtualenv to set up a self-contained python, one that lives totally inside a single folder that can be managed with usr-level pip install, no sudo needed.

mattip
  • 2,360
  • 1
  • 13
  • 13