Python Forum
pip error on Ubuntu 18.04.6 LTS
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pip error on Ubuntu 18.04.6 LTS
#1
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
Reply
#2
try

pip3 install -U scikit-learn
Reply
#3
(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.
Reply
#4
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).
Reply
#5
(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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Ubuntu: Error installing watson-developer-cloud Python module gio123 3 4,394 Mar-15-2018, 09:39 PM
Last Post: gio123
  Script works ok on windows but gives error on ubuntu papampi 3 4,050 Oct-11-2017, 04:17 PM
Last Post: papampi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020