Python Forum
pip error on Ubuntu 18.04.6 LTS - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: pip error on Ubuntu 18.04.6 LTS (/thread-36912.html)



pip error on Ubuntu 18.04.6 LTS - silbro - Apr-11-2022

Hi all

I've already searched so many places for a hint to where my problem with pip could be. I also made a post by ubuntu but haven't gotten an answer that helps me. So I thought maybe someone here knows a solution to my problem.

I have an ubuntu server 18.04.6 LTS installed. I have multiple python versions running. I had to compile python 3.7 because it didn't work otherwise (at the time at least). Unfortunately whenever I try to install something via the pip command I get an error like this:

pip install -U scikit-learn
Collecting scikit-learn
  Downloading scikit_learn-1.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (24.8 MB)
     |████████████████████████████████| 24.8 MB 1.3 MB/s
free(): invalid pointer
Aborted (core dumped)
I tried the following:
  • removing and reinstalling python3-pip
  • deleting the cache
  • run it as a different user
  • install python 3.7 with apt install

strangely enough when I try to install with pip2, it works. But I need theses packages in python 3.7. It did work at some point, I don't know exactly when it stopped working (unfortunately).

Does anyone have any idea of what I could try as well or where the error could be?

Thanks so much in advance!
silbro


RE: pip error on Ubuntu 18.04.6 LTS - Axel_Erfurt - Apr-11-2022

try

pip3 install -U scikit-learn


RE: pip error on Ubuntu 18.04.6 LTS - silbro - Apr-12-2022

(Apr-11-2022, 04:23 PM)Axel_Erfurt Wrote: try

pip3 install -U scikit-learn

Thanks for your reply and suggestion!

I tried that and get the same error. It only works with pip2.


RE: pip error on Ubuntu 18.04.6 LTS - snippsat - Apr-12-2022

Make a virtual environment and see if it work.
Here a quick intro and remember that virtual environment(venv) is build into Python for ease of use.
# Test version before start
tom@tom-VirtualBox:~$ python -V
Python 3.10.2
tom@tom-VirtualBox:~$ pip -V
pip 21.2.4 from /home/tom/.pyenv/versions/3.10.2/lib/python3.10/site-packages/pip (python 3.10)

# Make environment
tom@tom-VirtualBox:~$ python -m venv sci_env
# Cd in
tom@tom-VirtualBox:~$ cd sci_env/
# Activate
tom@tom-VirtualBox:~/sci_env$ source bin/activate

# Test pip again,see that it now point to this folder
(sci_env) tom@tom-VirtualBox:~/sci_env$ pip -V
pip 21.2.4 from /home/tom/sci_env/lib/python3.10/site-packages/pip (python 3.10)
# Install
(sci_env) tom@tom-VirtualBox:~/sci_env$ pip install scikit-learn
Collecting scikit-learn
 .....
Successfully installed joblib-1.1.0 numpy-1.22.3 scikit-learn-1.0.2 scipy-1.8.0 threadpoolctl-3.1.0

# Test that it work
(sci_env) tom@tom-VirtualBox:~/sci_env$ python
Python 3.10.2 (main, Jan 31 2022, 15:25:53) [GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
>>> 
>>> sklearn.__version__
'1.0.2'
>>> exit()
(sci_env) tom@tom-VirtualBox:~/sci_env$
Also Python 3.7 start to get old now,if looking at upgrade or pyenv tutorial(what i use in demo over).


RE: pip error on Ubuntu 18.04.6 LTS - silbro - Apr-13-2022

(Apr-12-2022, 08:46 AM)snippsat Wrote: Make a virtual environment and see if it work.
Here a quick intro and remember that virtual environment(venv) is build into Python for ease of use.
# Test version before start
tom@tom-VirtualBox:~$ python -V
Python 3.10.2
tom@tom-VirtualBox:~$ pip -V
pip 21.2.4 from /home/tom/.pyenv/versions/3.10.2/lib/python3.10/site-packages/pip (python 3.10)

# Make environment
tom@tom-VirtualBox:~$ python -m venv sci_env
# Cd in
tom@tom-VirtualBox:~$ cd sci_env/
# Activate
tom@tom-VirtualBox:~/sci_env$ source bin/activate

# Test pip again,see that it now point to this folder
(sci_env) tom@tom-VirtualBox:~/sci_env$ pip -V
pip 21.2.4 from /home/tom/sci_env/lib/python3.10/site-packages/pip (python 3.10)
# Install
(sci_env) tom@tom-VirtualBox:~/sci_env$ pip install scikit-learn
Collecting scikit-learn
 .....
Successfully installed joblib-1.1.0 numpy-1.22.3 scikit-learn-1.0.2 scipy-1.8.0 threadpoolctl-3.1.0

# Test that it work
(sci_env) tom@tom-VirtualBox:~/sci_env$ python
Python 3.10.2 (main, Jan 31 2022, 15:25:53) [GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
>>> 
>>> sklearn.__version__
'1.0.2'
>>> exit()
(sci_env) tom@tom-VirtualBox:~/sci_env$
Also Python 3.7 start to get old now,if looking at upgrade or pyenv tutorial(what i use in demo over).

Thank you very much for this information, I appreciate it. I'll be reading into this and test it over the weekend.