Ubuntu 14.04 Installing Numpy and Scipy without Root Access - python

A remote server that I used for python development recently migrated to Ubuntu 14.04 and it has broken my numpy and scipy installation. I do not have root access and everything I have tried has resulted in failure. So far I have:
1) Tried to install numpy from source built with the system version of python. This gives a PyUnicodeUCS2_FromUnicode error which I believe is because the system version uses ucs4. As I do not have root access I do not know if there is anything I can do about this.
2) Tried to install numpy using pip. This gives an error saying that it cannot find the Python.h header file that is included in python-dev. Again, I have no root access so cannot install python-dev.
3) Tried to create a virtual environment and install a new version of python. Initially I got a httpsrequest import error which meant I couldn't use pip but I was able to install from source. However when I then installed scipy and tried to import a module, I got the error that a libgfortran library was not found.
I've spent the last day trying to find a solution to this but everything I try seems to encounter an error somewhere. I also don't want to have to install to much stuff (i.e. dependencies) in my home directory to get this to work as I only have a limited amount of space. Any ideas on how I could proceed?

Have you considered using an 'all-in-one' package for scientific computing with Python, such as
Canopy
Anaconda
Miniconda

Have you tried downloading Sage? You can just use it as an Ipython system if you want (sage -ipython) and then import numpy and scipy.
There seems to be a binary for 14.04, though I don't know the specifics of your platform.
(This does have the downside that it is a very large install, of course, so it may not suit your needs, but it should make it easy, anyway.)

Related

How to remove hidden utdated scipy file so it won't import with python in VS Code OSX

I am currently trying to run a program with Scipy, and I want to use the load_npz module.
Whenever I tried to run it, the compiler would say that that module doesn't exist.
I ran scipy.__version__ and got 0.13.0b1, which makes sense as to why it couldn't find the module as it doesn't exist in that version, but I am confused as I have 1.5.2 installed in both pip and brew yet it keeps defaulting to the oldest version which is very frustrating.
Does anybody know how to get rid of this version? I have tried uninstalling from pip and brew, along with finding the path of the imported scipy with the outdated version yet it still is causing issues.
I do have a lot of packages installed (numpy, matplotlib, etc.) so could it be a dependency that keeps reinstalling an old version?
Strangely, even if I delete scipy from both brew and pip, it will still show the old version but throw an error on a different local file that also uses scipy saying the module does not exist (which is expected as I deleted it).
write this python to find out the location of the imported scipy
import scipy
print(scipy.__file__)
I figured it out, I just deleted all my possible scipy locations and then just downloaded Anaconda and I'm using that as my python interpreter.

NumPy module not found after install

So after numerous attempts at installing NumPy, all seem to have gone well until I boot up PyCharm and import numpy. It throws the "Module not found" error with just a single line of code, being:
import numpy as numpy
It's getting fairly frustrating, after installing numpy through pip, downloading the .whl and manually installing it, and even somehow bricking my computer by repairing python 3.6. I've got no idea as to what I'm doing wrong. Help would be greatly appreciated.
Without knowing exactly what you have installed in your computer, it can be a bit tricky to troubleshoot it. However, you have to be aware that you can have multiple Python installations in your computer. It is quite common to have Python2.X and Python3.X side by side.
When you used pip to install numpy, you installed it for a specific Python interpreter (sometimes you have pip2 and pip3 in your system, for example). And then, when you use PyCharm, it may be grabbing the wrong Python interpreter. You can go to File/Settings/Project and you will find something like the window below:
You will see that you can choose your interpreter and it will give you the list of all installed packages. I suggest that you check that you have numpy listed.
Moreover, from the same window you can install the packages you need; just click on the green + sign at the right of the screen and search for numpy and follow the needed steps.
Pro Tip: You should definitely consider using virtual environments, which are entirely supported by PyCharm.

Import Error: no module named numpy (numpy already installed)

I have a question which is very similar to Import Error: No module named numpy but the answer to that question I do not believe would be appropriate for me, so I'm asking again.
This is my most recent effort after about six hours of trying to get modules to work in python (numpy is a dependency of something else), so I'm finally turning to SO. Part of efforts in the last six hours included installing the enthought distribution, as its large volume of libraries was highly advised for windows users. I've even thrown the location of numpy folder onto the path of environment variables just to exclude it as a possibility.
Windows, 64bit, Python 2.7
Since you are on windows, I highly recommend that you install ANACONDA. This way the environment variables are set automatically and you don't need to worry about anything else. There are many useful packages (e.g. numpy, sympy, scipy) which are bundled with anaconda.
Moreover, based on personal experience I can tell you that using pip on windows and compiling from source (you need visual studio) is a pain in the neck sometimes. That's why ANACONDA has been conceived.
Hope this helps.
For python versions > 3.4 ,do this
pip install numpy beacuse pip is python dependency which installs packages just like npm in js i.e. node.js

Python 3.4: Error while installing scipy

I'm having problem with installing package SciPy for python 3.4 on Windows 10. There is an error I've got from cmd on admin mode. Other packages I installed correctly, such as numpy, scikit_learn, matplotlib.
There is the error message
Also I tried using
python pip -m scipy
But it didn't work out well. As the error message shows, probably there is sth with Lapack, but I have no idea how to fix this.
Because you try to install by source code, you need first compile and setting dependencies. Log file shows that not dependencies were found.
The hard way, download, compile and setting all dependencies. The easy way, you can use a python distrubution that install all for you (a lot packages by default, e.g. numpy, scipy, matplotlib, pandas, ipython, spyder). A good recommendation of python distribution is Anaconda.

What version of scipy and matplotlib should I install on Mac Mountain Lion?

I wish to install python numpy, scipy, and matplotlib packages. I used the following:
sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose
I was able to install and run numpy, but not scipy or matplotlib. I get an error, "No module named scipy", even though installation appeared to proceed normally. I suspect that this has something to do with the version of scipy and bumpy. I am running OS X Version 10.8.4, python 2.7.2 and numpy 1.6.1. I suspect the problem is either the version or the directory which scipy is installed; scipy is in /Users/myname/src/scipy. I couldn't find out where numpy is located (how can this be done? Spotlight search does not indicate file directory, and grep hangs). How can I install scipy and other packages?
It's hard to be 100% sure without a little more information, but I'm 99% sure…
Your problem is that you're installing all this stuff for the MacPorts Python, but then trying to run Apple's Python, which doesn't have any of it installed. (Part of the reason I suspect this is that Apple's Python is version 2.7.2, while MacPorts has been on 2.7.5 for a long time now. The other part of the reason is that this is exactly the same kind of problem people have when they install two different Python X.Y versions without realizing that's what they're doing.)
If you want to use the MacPorts Python, run /opt/local/bin/python instead of just python.
If you know what you're doing, you can change your PATH, or create a symlink, etc., but I suspect you will just confuse yourself further.
I personally think you'd be a lot happier just sticking to Apple's Python. You need to install a Fortran compiler with MacPorts (or Homebrew, or manually, or …), but to install Python packages, just use pip.
(At this point, that last bit of advice probably won't help you, as the first pip on your PATH is probably the MacPorts one, and doesn't match the first python on your PATH. But if you're willing to start over, just port uninstall python, and then look at these blog posts or the dozens of related questions here on SO.)

Categories

Resources