Python 3.5 Scipy Optimize Import Error - python

Encountered the following problem when trying to use the module scipy.optimize.slsqp.
>>> import scipy.optimize.slsqp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/site-packages/scipy/optimize/__init__.py",
line 233, in <module>
from ._minimize import *
File "/usr/local/lib/python3.5/site-
packages/scipy/optimize/_minimize.py", line 26, in <module>
from ._trustregion_dogleg import _minimize_dogleg
File "/usr/local/lib/python3.5/site-
packages/scipy/optimize/_trustregion_dogleg.py", line 5, in <module>
import scipy.linalg
File "/usr/local/lib/python3.5/site-packages/scipy/linalg/__init__.py",
line 190, in <module>
from ._decomp_update import *
File "scipy/linalg/_decomp_update.pyx", line 1, in init
scipy.linalg._decomp_update (scipy/linalg/_decomp_update.c:39096)
ImportError: /usr/local/lib/python3.5/site-
packages/scipy/linalg/cython_lapack.cpython-35m-x86_64-linux-gnu.so:
undefined symbol: zlacn2
I'm using Python3.5, Scipy 0.17.0, Numpy 1.10.1, the OS is CentOS 5.11. Could anyone shed some lights into this? Thank you.

You need to install SciPy math dependencies.
sudo apt-get install libatlas-base-dev liblapack-dev
The above command is for Debian related OS. Please check what has to be installed for CentOS

You have to install the math dependencies
sudo apt-get install libatlas-base-dev liblapack-dev

Related

ModuleNotFoundError: No module named 'pyarrow.lib'

This is the full error message.
Traceback (most recent call last):
File "C:\Users\adi\OneDrive\Desktop\Python310\machine learning project.py", line 3, in <module>
import streamlit as st
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\__init__.py", line 70, in <module>
from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\delta_generator.py", line 19, in <module>
from streamlit import cursor, caching
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\cursor.py", line 18, in <module>
from streamlit.scriptrunner import get_script_run_ctx
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\scriptrunner\__init__.py", line 16, in <module>
from .script_runner import (
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\scriptrunner\script_runner.py", line 35, in <module>
from streamlit.state import (
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\state\__init__.py", line 27, in <module>
from .session_state_proxy import (
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\state\session_state_proxy.py", line 24, in <module>
from streamlit.type_util import Key
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\streamlit\type_util.py", line 22, in <module>
import pyarrow as pa
File "C:\Users\adi\OneDrive\Desktop\Python310\lib\site-packages\pyarrow\__init__.py", line 65, in <module>
import pyarrow.lib as _lib
I am working with streamlit for a project but can't work out this problem.
I have tried uninstalling and reinstalling streamlit but that did'nt help.
i using python 3.8
Uninstalling and re-installing solved the issue for me:
pip uninstall pyarrow
pip install pyarrow
I think I messed things up by changing the Python version in my Conda environment.
You need to install pyarrow
python3 -m pip install pyarrow
Check these 2 things(worked for me) -
1-If you have changed your python version recently, uninstall all libraries then install.(can be done easily by pip uninstall -r requirements.txt -y & then pip install -r requirements.txt -y
2- If you have installed pyarrow in a different environment.

How can i fix if pip3 is not working after instalation?

I was trying to install matplotlib but first I had to install pip in MobaXterm and I think something failed.
I did:
python -m ensurepip
apt-get install python3-pip
Here I didn't want to, but I closed MobaXterm.
Then I tried starting again and I got:
Found package python3-pip
Package python3-pip is already installed, skipping
But then, when I try to install matplotlib:
pip3 install matplotlib
And I got:
Traceback (most recent call last):
File "/bin/pip3", line 7, in <module>
from pip import main
File "/usr/lib/python3.4/site-packages/pip/__init__.py", line 13, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3.4/site-packages/pip/utils/__init__.py", line 22, in <module>
from pip._vendor import pkg_resources, six
File "/usr/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 36, in <module>
import plistlib
File "/usr/lib/python3.4/plistlib.py", line 65, in <module>
from xml.parsers.expat import ParserCreate
File "/usr/lib/python3.4/xml/parsers/expat.py", line 4, in <module>
from pyexpat import *
ImportError: No such process
Thank you and sorry, I'm really not an experienced programmer.

trying to install pyperclip in python2.7

everytime i run this i face this problem
> sudo pip install pyperclip
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
File "/home/ot/.local/lib/python2.7/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/home/ot/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 22, in <module>
from pip.compat import console_to_str, expanduser, stdlib_pkgs
ImportError: No module named compat
ps: im using python 2.7 and this has been happening to me while trying to download other few packages as well
I'm on ubuntu 16.04
Thank you
problem solved i used these 2 lines :
sudo apt-get update
sudo apt-get install python-pyperclip

Using Pip and Importing Packages in Python 3 on Ubuntu

I'm on Lubuntu (a minimal build of Ubuntu). I installed Python 3.6.1 with:
sudo apt-get install python3.6
I want to use Twilio, so I tried this:
pip install twilio
It said pip wasn't recognized, so I ran this, followed by the above again:
sudo apt install python-pip
I fired up Python 3.6 and tried importing it, but that didn't work out:
>>> from twilio.rest import Client
ModuleNotFoundError: No module named 'twilio'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
I'm new to python3 (which I want to use for the secrets module), Ubuntu, and twilio, so I'm not really sure what's going on here. I'd think if it was as simple as a module not being found, the stack trace would be much shorter... I'm not sure if the stack trace is so long because maybe Python 3 produces longer ones than 2 did, or Ubuntu is trying to do something weird because both Python 2 and 3 are installed (and perhaps two versions of 3 at that), or if maybe this is the work of twilio?
Try the following to download pip:
wget https://bootstrap.pypa.io/get-pip.py
Then install pip by running:
sudo python3 get-pip.py
Then you can install twilio with pip
sudo pip3 install twilio

ImportError: No module named 'numpy.ma'

The full error:
import matplotlib
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import matplotlib
File "R:\Python34\lib\site-packages\matplotlib\__init__.py", line 180, in <module>
from matplotlib.cbook import is_string_like
File "R:\Python34\lib\site-packages\matplotlib\cbook.py", line 34, in <module>
import numpy.ma as ma
ImportError: No module named 'numpy.ma'
numpy is imported normally.
How do I install numpy.ma?
I also faced the same situation today. I found that I had saved a file as numpy.py, so check the filenames in your folder.
Re-install the correct version of numpy.
download correct .whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
pip install C:\Path\To\Wheel\Filename.whl # for example: numpy-1.9.2+mkl-cp34-none-win_amd64.whl
Use Your (via terminal) package manager and search.
Example on Ubuntu:
aptitude search numpy
and install package.
In my case:
apt-get install python-numpy

Categories