Reinstalling numpy under ubuntu - python

Somehow I managed to break a working numpy library (I tried to install some optimization libraries).
If I run import numpy in ipython then I get ImportError: libblas.so.3gf: wrong ELF class: ELFCLASS32.
Reinstallation of numpy does not help (using sudo-apt get remove/install).
I see that the problem is libblas is 32bit version. I did not find 64 version in synaptic package manager.
Another confusing part is, ipython says that error is in
`/home/andrey/.local/lib/python2.7/site-packages/numpy/linalg/linalg.py`
but when I delete numpy, this folder still exists.
Do you know how can I fix it?

~/.local/lib/python2.7 is the per-user installation directory, of course you cannot uninstall numpy from there using apt-get. As numpy there is apparently 64bit, it requires 64bit libs so you need to install 64bit libblas on your system.

Related

"stereoscope" package installation in Python

I have installed the package "stereoscope" successfully a few days ago and have been using it to do analysis. However, when I am trying to use it today I got the error that the command "stereoscope" is not found. I suspect that this error usually comes up when the package is not installed. It is weird I know. Therefore, I tried to install it again. However, I found the problem "numpy 1.21.1 is installed but numpy<1.21,>=1.17 is required by {'numba'}". What I understand from this error is that I need to install the NumPy version less than 1.21.1 or greater than or equal to 1.17. So, I tried to install the required version such as NumPy 1.20.3. The issue remains the same. I do not know why it is still saying my numpy version is 1.21.1 even after I uninstalled this version. Please help me with how to resolve this issue?
This is the link where I follow to do the installation stereoscope installation
I tried to update the numba and use the command "pip list" to get numba version is 0.53.1 and the numpy version is 1.21.1. But still do not resolve the error. I have uninstalled the numpy version 1.21.1 and change it to numpy version 1.20.3 but the error remains.
I have resolved this issue by uninstalled all version of numpy that present on my system. I then create a new virtual environment. I start install the package stereoscope including all required packages on this virtual environment. This way there will be no crush between these installation and my computer system.

How to update the version of pandas that I'm using in Visual Studio code. I think my python installs are setup improperly

I've scoured the internet without much luck of finding how to fix what I'm doing wrong. I think I have all the pieces to the puzzle and know what is wrong but I just don't know what I need to do to fix it.
I'm starting to think I have two installs of python and I'm not updating the install that's being used in VS code and the python install that I have updated is not properly setup in VS code. I have anaconda downloaded but I think the VS code python extension is the only one that is set up properly. If I use the anaconda prompt and follow what a number of posts/solutions detail
import pandas as pd
pd.__version__
I get 1.1.3 which I believe I updated the other day when trying to fix my issue. However, if I use the terminal in VS code and do the same thing, I get 1.0.5 (which is the pandas version that produces the issue I am dealing with... it messes with dates when plotting pandas df). I'm guessing this has something do to with anaconda not being set to PATH and VS code is using the extension instead of the anaconda download. To further back this up, if I select
Python 3.7.9 64-bit (conda) interpreter instead of Python 3.7.9 64-bit
and run code that typically works on the non-conda interpreter, I get the following:
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.7 from "C:\Users\user
\anaconda3\python.exe"
* The NumPy version is: "1.19.2"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed: The specified module could not be found.
If what I suspect is the issue, then I'm a bit confused how I've been able to import and use packages such as pandas, matplotlib, and Numpy when using the non-conda interpreter.
Would someone be able to explain and steer me in the right direction?
The reason for getting two different versions of "pandas" is that the Python interpreter you are using is different. The "Python 3.7.9 64-bit" you use is the python interpreter (global environment) that you downloaded and installed, and the "Python 3.7.9 64-bit (conda)" is the Python interpreter that comes with Anaconda (conda environment).
According to the terminal information you provided, there is no dependent package "numpy" of "pandas" in a non-conda environment. It is recommended that you install the module "numpy" (pip install numpy). Usually, when the module "pandas" is installed, the terminal will automatically install the dependencies it needs. Therefore, you could also reinstall "pandas" in the VSCode global environment.
If you want to specify a certain version of the module "pandas", you could use "pip install pandas==1.1.3" to install version 1.1.3.

Importing Numpy results in error even though Anaconda says it's installed?

I signed up for a statistics udemy course which uses jupyter running the stock numpy package out of anaconda.
Numpy is working when I run python 3.4.4 in pycharm, but it will not work in either anaconda2 nor anaconda3.. this makes no sense because numpy comes stock as part of the anaconda library.
When I try importing numpy in jupyter, running a local instance of a python 2 script, I get this:
Thinking I could sidestep the error using a IDE, I tried pycharm and I got this:
Numpy is part of the anaconda default library which I'm running, so I checked and made sure the numpy package was there via the Anaconda Prompt using 'conda list'...
Why won't it import successfully?
Before I uninstall and reinstall everything, does anyone have any ideas?
Yayyyy. I figured it out. So I had several different python versions before I was running python through anaconda/jupyter. As a result, the tethering in-between the additional package libraries to the version of python running was shifty. For example, I may have had numpy working configured to 3.4 but not 2.7..
anyways, to break down the steps I took, I uninstalled all instances of python (both anaconda and normal versions). Then I deleted the old 3.4 libraries from my C drive. Then I installed anaconda 2.7.11 again, tested importing numpy and got the same error. Then I thought to myself, what if the packages are installed separate from the python library and their configuration didn't get reset via the reinstall.. so via the anaconda prompt I typed:
pip uninstall numpy
which removed the package I was having trouble with. and then :
pip install numpy
which downloaded and reset a whole new instance of the package. Then I tested importing numpy in both the anaconda prompt and jupyter = both worked.
I'm very happy that this ended up working out as I can continue on as planned. For anyone else who experiences a similar problem, I would try uninstalling, then reinstalling the problem causing package via pip commands - this step seemed to have the most impact on fixing the problem. Then if that doesn't work proceed to uninstall and reinstall the environments in intervals.
You can try using the following command:
pip install numpy --upgrade
This will uninstall old installed version of numpy and install a new version. This command solved my issue.
try activating you base conda environment before starting jupyter.
>activate root
>jupyter notebook

Ubuntu 14.04 Installing Numpy and Scipy without Root Access

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.)

Installing numpy on Red Hat 6?

I'm trying to install numpy on a Red Hat (RHEL6) 64-bit linux machine that has Python 2.7. I downloaded and untar'd numpy 1.6.2 from Sourceforge, and I did the following commands in the numpy-1.6.2 folder:
python ./setup.py build
sudo python ./setup.py install #without sudo, this gives a permissions error.
Then, when I do import numpy on the Python prompt, I get ImportError: No module named numpy.
I read somewhere that numpy 1.6.2 is for Python 3.x, so I also tried the above steps with numpy 1.5.1, and I got the same ImportError.
I'm speculating that the solution lies in some environment variable gymnastics, but I'm not sure what files/directories Python needs to "see" that isn't in scope. Any suggestions for how to get numpy working?
I also tried some precompiled binaries for RHEL, but they gave various errors when I did sudo yum install [numpy precompiled binary url].rpm.
As an aside, my motivation for installing numpy is to use PyGnuplot. Also, I've installed numpy and PyGnuplot on other machines before, but it's been on Ubuntu and Mac OS.
RHEL6 ships numpy 1.4.1, see distrowatch. If 1.4.1 is new enough for you, you can install it with:
$ yum install numpy
When I install Python packages on Ubuntu using setup.py packages end up in
/usr/local/lib/python2.7/dist-packages/
assuming Python2.7
If numpy is installed there, you will need to append this path to your Python's path:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages/
you can append it permentanly using ~/.profile
Another way is by adding a .pth to a directory that’s already on Python’s path, for example
echo "/usr/local/lib/python2.7/dist-packages/" > /usr/local/lib/python2.7/site-packages/dist_pkg.pth
run that last command as root of course
I gave up on using RedHat, and I installed Ubuntu in a VM. It was a one-liner using apt-get.
Not an ideal solution to the question at hand, but I just didn't want to spend any more time chasing down a solution for RedHat.

Categories

Resources