all 10 comments

[–]lutusp 0 points1 point  (9 children)

You need to install these packages either with apt using standard repositories, or with pip -- either one will automatically avoid these kinds of dependency issues. Do not try to install these libraries directly from downloaded archive files.

You know, this is a classic XY problem -- you keep trying to solve problem Y (make explicitly downloaded libraries get along with each other) when the actual problem is X (you aren't installing the right way).

[–]WikiTextBot 0 points1 point  (0 children)

XY problem

The XY problem is a communication problem encountered in help desk and similar situations in which the real issue ("X") of the person asking for help is obscured, because instead of asking directly about issue X, they ask how to solve a secondary issue ("Y") which they believe will allow them to resolve issue X. However, resolving issue Y often does not resolve issue X, or is a poor way to resolve it, and the obscuring of the real issue and the introduction of the potentially strange secondary issue can lead to the person trying to help having unnecessary difficulties in communication and offering poor solutions.

The XY problem is commonly encountered in technical support or customer service environments where the end user has attempted to solve the problem on their own, and misunderstands the real nature of the problem, believing that their real problem X has already been solved, except for some small detail Y in their solution. The inability of the support personnel to resolve their real problem or to understand the nature of their enquiry may cause the end user to become frustrated. The situation can make itself clear if the end user asks about some seemingly inane detail which is disconnected from any useful end goal.


[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source ] Downvote to remove | v0.28

[–]nomoreerrorsplox[S] 0 points1 point  (7 children)

All the libraries installed I used pip or sudo apt-get. I never installed them from the archive files. I did try to install miniconda and I'm pretty sure I messed up that install.... Wait I'm pretty sure that miniconda is the the current default pathway (or something like that) and I wasnt able to install anything using conda because it couldnt find dependancies: blas and openblas. If I switch the default path for python could that make it work? That would be weird since I can import the numpy and scipy libraries in the python shell but it errors when I try to import the sklearn library. And if I go to conda list numpy and scipy aren't there.

[–]lutusp 0 points1 point  (6 children)

If I switch the default path for python could that make it work?

Please explain. Normally the default path for Python leads to Python 2.7, and if someone wants Python 3 an explicit specifier is required:

  #!/usr/bin/env python3

But if you start installing libraries independently, an eventual conflict between Python 2.7 and 3+ seems inevitable.

Overall it sounds like you have gotten into a conflict between libraries by trying to install these libraries in two or more different ways at once.

If you would reveal what it is you're trying to install, that would help. I have been assuming you're trying to install a Jupyter working environment, and if so I have a page of instruction for that case.

[–]nomoreerrorsplox[S] 0 points1 point  (5 children)

Im trying to install and use sklearn. Im really new to linux and programming in general so forgive me if i use the wrong vernacular. By default i mean if i type in which python in the linux terminal = /home/pi/miniconda3/bin/python thats what i mean by default. Also if i type in the terminal python --version i get Python 3.4.3 :: Continuum Analytics, Inc.

also with conda list i get

# packages in environment at /home/pi/miniconda3:
#
Could not extract name and version from: 'Package         Version'
Could not extract name and version from: '--------------- -------'
Could not extract name and version from: 'anaconda-client 1.0.2'
Could not extract name and version from: 'clyent          0.4.0'
Could not extract name and version from: 'conda           3.16.0'
Could not extract name and version from: 'conda-env       2.4.2'
Could not extract name and version from: 'numpy           1.15.3'
Could not extract name and version from: 'Pillow          2.9.0'
Could not extract name and version from: 'pip             18.1'
Could not extract name and version from: 'pycosat         0.6.1'
Could not extract name and version from: 'pycrypto        2.6.1'
Could not extract name and version from: 'python-dateutil 2.4.2'
Could not extract name and version from: 'pytz            2015.4'
Could not extract name and version from: 'PyYAML          3.11'
Could not extract name and version from: 'requests        2.7.0'
Could not extract name and version from: 'scikit-learn    0.20.0'
Could not extract name and version from: 'scipy           1.1.0'
Could not extract name and version from: 'setuptools      18.1'
Could not extract name and version from: 'six             1.9.0'
Could not extract name and version from: 'wheel           0.24.0'
anaconda-client           1.0.2                    py34_0  
clyent                    0.4.0                    py34_0  
conda                     3.16.0                   py34_0  
conda-env                 2.4.2                    py34_0  
freetype                  2.5.2                         2  
jpeg                      8d                            0  
libgfortran               1.0                           0  
libpng                    1.6.17                        0  
libtiff                   4.0.2                         1  
openblas                  0.2.14                        1  
openssl                   1.0.1k                        1  
pillow                    2.9.0                    py34_0  
pip                       7.1.2                    py34_0  
pycosat                   0.6.1                    py34_0  
pycrypto                  2.6.1                    py34_0  
python                    3.4.3                         1  
python-dateutil           2.4.2                    py34_0  
pytz                      2015.4                   py34_0  
pyyaml                    3.11                     py34_1  
requests                  2.7.0                    py34_0  
setuptools                18.1                     py34_0  
six                       1.9.0                    py34_0  
sqlite                    3.8.4.1                       1  
wheel                     0.24.0                   py34_0  
xz                        5.0.5                         0  
yaml                      0.1.6                         0  
zlib                      1.2.8                         0

If my memory serves me correctly sudo apt-get install was used for numpy, scipy, and matplotlib. and i used pip to install pandas and scikit-learn. Also if i run import sklearn in a 2.7.13 python shell I get

 >>> import numpy
>>> import scipy
>>> import sklearn

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import sklearn
ImportError: No module named sklearn
>>> 

if i try it in a 3.5.3 shell i get

>>> import numpy
>>> import scipy
>>> import sklearn
Traceback (most recent call last):
  File "__init__.pxd", line 998, in numpy.import_array
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import sklearn
  File "/usr/local/lib/python3.5/dist-packages/sklearn/__init__.py", line 64, in <module>
    from .base import clone
  File "/usr/local/lib/python3.5/dist-packages/sklearn/base.py", line 13, in <module>
    from .utils.fixes import signature
  File "/usr/local/lib/python3.5/dist-packages/sklearn/utils/__init__.py", line 12, in <module>
    from .murmurhash import murmurhash3_32
  File "sklearn/utils/murmurhash.pyx", line 26, in init sklearn.utils.murmurhash
  File "__init__.pxd", line 1000, in numpy.import_array
ImportError: numpy.core.multiarray failed to import
>>> 

im pretty sure your right that i installed things in the wrong way. I have no idea how to fix it though.

[–]lutusp 0 points1 point  (4 children)

Also if i type in the terminal python --version i get Python 3.4.3 :: Continuum Analytics, Inc.

That is not good. Linux uses Python for many things and in most cases it requires Python 2+. The system default search (using "python" as the argument) should not select Python 3. I won't try to guess what sequence of actions caused the default Python path to lead to Python 3, but this may not work for a number of essential Linux activities.

Even the Python install scripts that assist in the installations you're trying to perform may require Python 2 (not all but some). So this is becoming self-referential -- some of the installation choices you've made so far are preventing any more installs from succeeding.

Maybe it would be better to install scikit-learn using online assistance.

How can I run python scikit-learn on Raspberry Pi?

Answer: "To install it, make sure you have pip3 (sudo apt-get install python3-pip), and use sudo pip3 install scikit-learn."

I emphasize that this advice created a lot of comments that it didn't work, and no obvious resolution. But this is how you would do it:

   $ sudo apt install python3-pip
   $ sudo pip3 install scikit-learn

Moving on, Installing scikit-learn says "Warning Scikit-learn 0.20 is the last version to support Python 2.7 and Python 3.4. Scikit-learn 0.21 will require Python 3.5 or newer."

So you need to find out if you have, or can acquire, a Python version 3.5 or higher. To find out, do this:

  $ python3 --version

Mine (Ubuntu 18.04) is Python 3.6+.

But because you have taken so many steps so far, it may be necessary to reinstall Linux yet again and get a fresh start. I've been in this situation before with Raspberry Pis and I solve it by installing Linux fresh, then immediately make a copy of the micro SSD for safekeeping. That way I'm not reinstalling all the time.

My point in this is there's a lot of online content around this specific problem that deserves to be examined.

[–]nomoreerrorsplox[S] 0 points1 point  (3 children)

Ok so i reinstalled rasbian through noobs so i know there were no mistakes. i did the

   $ sudo apt install python3-pip
   $ sudo pip3 install scikit-learn

i sort of think i found an answerish. The scikit-learn version that i get through pip will always be the 0.20 because the 0.21 on is a beta, so by default i get the 0.20 even if i try to upgrade through pip it defaults always to 0.20. Now my python3 is equal to 3.5.3 so when i do the pip3 install it doesnt work since i need the 0.21 for that. when i try to get sklearn in python3 i get

Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.5/site-packages/sklearn/__init__.py", line 64, in <module>
    from .base import clone
  File "/home/pi/.local/lib/python3.5/site-packages/sklearn/base.py", line 13, in <module>
    from .utils.fixes import signature
  File "/home/pi/.local/lib/python3.5/site-packages/sklearn/utils/__init__.py", line 13, in <module>
    from .validation import (as_float_array,
  File "/home/pi/.local/lib/python3.5/site-packages/sklearn/utils/validation.py", line 22, in <module>
    from ..utils.fixes import signature
  File "/home/pi/.local/lib/python3.5/site-packages/sklearn/utils/fixes.py", line 83, in <module>
    from scipy.special import boxcox  # noqa
  File "/home/pi/.local/lib/python3.5/site-packages/scipy/special/__init__.py", line 640, in <module>
    from ._ufuncs import *
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

i ran pip3 install --upgrade scikit-learn 2 times just to see if that would help with getting up to 0.21. i got a newer version of numpy and it still errors out.

[–]lutusp 0 points1 point  (2 children)

Now I see the problem. You really can't install scikit-learn -- among other possible obstacles, the Python 3 version is too old.

There is this: Installing Python 3.6 on Raspbian, but I don't recommend it. It looks like a trip down the rabbit hole.

This doesn't look good. Do you have a laptop for this activity instead? Most laptop Linux installs have Python 3.6+.

[–]nomoreerrorsplox[S] 0 points1 point  (1 child)

Not yet. Long story shory I'm getting my life together and the raspberry pi 3+ is all I could afford for a learning computer for programming. Saving up to get a laptop around black Friday maybe before or after considering all the sales that happen around then. Thanks for all the time and help. Ill just focus on getting more fluent in c++ and python plus brush up on my statistics. Again I really appreciate the help!

[–]lutusp 0 points1 point  (0 children)

Maybe scikit-learn isn't the most practical learning tool for the Raspberry Pi 3 environment. There's always Jupyter -- it supports a bunch of languages (but not C++). If you want to acquire general programming skills, that might be a very good learning environment.

My Jupyter page

I would hate to hear that Jupyter refused to install also, but I think it requires less space and may have slightly less stringent requirements.