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
Cannot import numpy in Python 3.7 or Python 3.8 - Ubuntu 18.04 #15826
Comments
|
I can't say how you could solve this problem with the system package manager ( |
|
It was my understanding that |
|
In the case of having multiple Python versions installed,
There are many ways to solve this problem. My suggestion is not necessarily the best and may not work for your specific case. I'd recommend PyPA's docs on virtualenv to see if this fits your needs. Ultimately this question has more to do with general Linux system administration than NumPy installation - I would also recommend the Arch wiki as an excellent resource in that regard. |
That's definitely not fine, NumPy contains C code and compiled Python extensions are specific to a minor Python version - you cannot mix 3.6 / 3.7 / 3.8
Correct
You need to install a Python version per Python version. Probably as simple as: and actually probably better to get rid of your apt-installed |
I think that is correct. |
I always thought it was STRONGLY discouraged to use |
|
@rossbar Quick question. If it's too off-topic, I understand. Is it best practice to use |
I sudo install distro numpy for the library dependencies, then That way the system numpy is left alone. In a virtual environment you don't need the PS: I want the system libraries because I always build from the repo. |
@charris Unfortunately this will only install numpy for me. I need to install it for all users. |
I'm not really an expert here - from my perspective, PEP 405 is a nice read on this topic if you're interested in the design/motivations for |
|
Another option is to use conda to install multiple environments. |
|
For |
|
Well thank you all for the guidance all on venv vs. virtualenv. As well as for clearing up why I was having an issue. I realize this isn't a numpy problem so i'll have to ask elsewhere and try out different tools to fix it. One final question. And if it's too, too off-topic that's fine. I see in many places people saying to never use |
|
@jrisi256 I think the recommendation is to not use sudo unless you know what you are doing. It isn't terrible in itself, it's just that it gives you enough power to get in trouble :) For my single user case it simply isn't needed, for an administrator it may be required. That said, there may be good reasons that I don't know about. |
Hello! Hope all the devs are staying safe during corona time and thanks for making such a great package.
I manage a group of users so I'm trying to figure out how I can install
numpyfor all of them to use without having everyone install the package themselves.I have Python 2.7.17 and Python 3.6.9 (installed by default through Ubuntu 18.04). Additionally, I have installed Python 3.7.5, Python 3.8.0, and
numpyusing the following.If I run
pythonorpython3orpython3.6which (invokes python 2.7.17 or python 3.6.9), I can run the following command just fine.However, if I try to run the above after running
python3.7orpython3.8I get the following error message:ImportError: cannot import name 'multiarray' from 'numpy.core' (/usr/lib/python3/dist-packages/numpy/core/__init__.py)When I install
numpyit gets installed to /usr/lib/python3/dist-packages which should be fine since it's on thesys.path()for all versions of Python.Could it not be working because the version of
numpybeing pulled using apt is only for Python 3.6.9? If that's the case, how should I installnumpyfor all users for ALL versions of Python?The text was updated successfully, but these errors were encountered: