Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError on Raspberry Pi #14553

Closed
Chris-Field opened this issue Sep 20, 2019 · 10 comments
Closed

ImportError on Raspberry Pi #14553

Chris-Field opened this issue Sep 20, 2019 · 10 comments
Labels
57 - Close? Issues which may be closable unless discussion continued

Comments

@Chris-Field
Copy link

When i try to run a python script that uses numpy, i receive the following error:
ImportError: Unable to import required dependencies.
...
Original error was: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.27' not found (required by /usr/local/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-arm-linux-gnueabihf.so)"

Reproducing code example:

Can be reproduced simply with this:

import numpy as np

Error message:

_Traceback (most recent call last):
File "<pyshell#0>", line 1, in
import numpy
File "/usr/local/lib/python3.7/site-packages/numpy/init.py", line 142, in
from . import core
File "/usr/local/lib/python3.7/site-packages/numpy/core/init.py", line 47, in
raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.

  • Try uninstalling and reinstalling numpy.

  • If you have already done that, then:

    1. Check that you expected to use Python3.7 from "/usr/local/bin/python3.7",
      and that you have no directories in your PATH or PYTHONPATH that can
      interfere with the Python and numpy version "1.17.2" you're trying to use.
    2. If (1) looks fine, you can open a new issue at
      https://github.com/numpy/numpy/issues. Please include details on:
      • how you installed Python
      • how you installed numpy
      • your operating system
      • whether or not you have multiple versions of Python installed
      • if you built from source, your compiler versions and ideally a build log
  • If you're working with a numpy git repository, try git clean -xdf
    (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.27' not found (required by /usr/local/lib/python3.7/site-packages/numpy/core/multiarray_umath.cpython-37m-arm-linux-gnueabihf.so)

Numpy/Python version information:

Unable to run the recommended command, but here is what I know about the version info:
Python is 3.7 (if I import numpy on 3.5 or 2.7 it works)
numpy is 1.17.2

Additional Info

 - how you installed Python: I'm sorry I don't remember how or know how to find out.
 - how you installed numpy: tried several ways, the most recent being `sudo pip3.7 install numpy`
 - your operating system: Linux raspberrypi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux
 - whether or not you have multiple versions of Python installed: 2.7, 3.5, 3.7  Possibly others, I'm not sure how to tell.
 - if you built from source, your compiler versions and ideally a build log: Not sure where to grab this.

I should note that I first received this error and got "libf77blas.so.3...no such file" for the "Original error" section. I made it past that by installing some dependencies from here: https://stackoverflow.com/questions/53347759/importerror-libcblas-so-3-cannot-open-shared-object-file-no-such-file-or-dire

I apologize for the lack of details. I'm new to Linux and relatively new to Python, but I'll happily gather anything else that's needed if you can point me in the right direction.

@mattip
Copy link
Member

mattip commented Sep 20, 2019

Original error was: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.27'

This usually indicates some incompatibility between the numpy you installed and one built specifically for your version of your OS. Did you get numpy via apt install python3-numpy or via sudo pip install numpy?

@Chris-Field
Copy link
Author

I’m not sure, but I believe I used both at one point or another while trying to fix this error. Usually it said it already met the requirements. Is there one in particular that I should use? Or would it be best to uninstall bumpy first and then use one of them?

@athyk
Copy link

athyk commented Sep 20, 2019

I have the same issue, its been 3 days it's not been solved

@seberg
Copy link
Member

seberg commented Sep 20, 2019

We try to help, but helping with these issues is not easy, and few people here have both the bandwidth and the knowledge of compile issues to help.
Plus these are not specific issues with numpy, but compile/linking issues related to the platform you are working on. E.g. asking in a Raspberry Pi forum is probably better than here. If you do now know how you installed (or how often you did), try to uninstall NumPy multiple times?
If you installed the wheel build, I suppose you may have to make sure you have the correct glibc version.

If you do not mind using apt, then that is probably the safest bet, please do pip uninstall and possibly even manually delete any remaining files first.

@seberg
Copy link
Member

seberg commented Sep 21, 2019

Please look at gh-14455, installing that should fix the issue.

@seberg seberg added the 57 - Close? Issues which may be closable unless discussion continued label Sep 21, 2019
@Chris-Field
Copy link
Author

i just tried it and got libatlas3-base is already the newest version (3.10.3-1+rpi1).

I installed it with sudo apt-get install libatlas3-base

Am i doing something wrong? I get the feeling this has something to do with the fact that I have multiple installs of Python. I'm trying to do everything with 3.7, but it seems like it all keeps defaulting to 2.7.

@PJOssenbruggen
Copy link

I am getting the following error for import numby as nb on a Raspberry Pi. I have no problems running py scripts on a Mac. The following information deals with the Raspberry Pi exclusively:

  1. Python 3.7.2 is installed using Miniconda3. https://gist.github.com/SeppPenner/6a5a30ebc8f79936fa136c524417761d
    On the Mac, I use Anaconda3.

  2. numpy is installed using the instruction given in "Installing Python 3.7.0 on Raspian." https://gist.github.com/SeppPenner/6a5a30ebc8f79936fa136c524417761d

  3. I have multiple versions of python installed.
    cd /usr/local/lib/ contains file: libpython3.7m.a and directories: pkgconfig, pypy2.7, python2.7 and python3.7.

Can someone help me interpret the following ImportError.

ImportError Traceback (most recent call last)
/usr/local/lib/python3.7/site-packages/numpy/core/init.py in
16 try:
---> 17 from . import multiarray
18 except ImportError as exc:

/usr/local/lib/python3.7/site-packages/numpy/core/multiarray.py in
13
---> 14 from . import overrides
15 from . import _multiarray_umath

/usr/local/lib/python3.7/site-packages/numpy/core/overrides.py in
6
----> 7 from numpy.core._multiarray_umath import (
8 add_docstring, implement_array_function, _get_implementing_args)

I tried inserting the try:code without success.

While searching for a solution to following error, I found Kitt-AI/snowboy#262 to be a solution to my problems.

ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

This worked for me: sudo apt-get install libatlas-base-dev

I hope this helps.

@Chris-Field
Copy link
Author

Figured it out! It turns out I had installed Python in an unofficial way: https://installvirtual.com/install-python-3-7-on-raspberry-pi/

As soon as I uninstalled and then reinstalled using sudo apt-get install python3.7 It worked just fine!

@emiliodallatorre
Copy link

Figured it out! It turns out I had installed Python in an unofficial way: https://installvirtual.com/install-python-3-7-on-raspberry-pi/

As soon as I uninstalled and then reinstalled using sudo apt-get install python3.7 It worked just fine!

Hi,
I'm not able to install Python 3.7 with apt. Could you please share how did you do that?

@Chris-Field
Copy link
Author

Hi,
I'm not able to install Python 3.7 with apt. Could you please share how did you do that?

All I did was use the command above on my Raspberry Pi 3. I think we’ll need more info on your issue if that doesn’t work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
57 - Close? Issues which may be closable unless discussion continued
Projects
None yet
Development

No branches or pull requests

6 participants