0

In short, my question is, how do I install the latest version of scikit-image into my usr/lib/python3/dist-packages so I can actually use it? I think there is a problem with my understanding of how third-party modules are installed. As a newb, I don’t know how to rectify that, hence this post.

I need help to understand how to install packages in python3 up until now I have used pip/pip3/apt-get/synaptic etc and it has worked fine for many packages. However, I have hit several barriers (Skimage, opencv, plantcv in python3). I must emphasise, the problem I am having is using these packages in python3, not 2.7.

For example, I want to use the latest version of scikit-image (0.14) with python3. (http://scikit-image.org/) I have tried using the installation instructions and have not yet successfully managed to install it. I have navigated to my usr/lib/python3/dist-packages and copied scikit-image into this directory (I have all the dependencies installed in here already). Image of my folder for dist-packages as proof

As you can see, the folder containing skimage is in the directory I want to be installed in, how do I actually install it? Do I have to extract skimage out of the folder into the directory and then run the install command? If I navigate to usr/lib/python3/dist-packages/scikit-image and then run pip install -e . I get an error, stating that I need numpy. If I write a python script using python3 I can clearly see I have it installed (and I have been using it for a long time). So, there must be a problem in how I have this package in my file system. I think a janky workaround would be to copy all the modules into my working directory and Import them that way as if they were modules I have made myself, but this obviously negates the whole point of installing packages.

This has also happened with another package called plantcv. Where I went into the directory usr/lib/python3/dist-packages then cloned the source from git hub and installed as per instructions. When I import plantcv in my python3 script. It Imports fine. But, there is nothing in it, as python cannot see the modules which are inside this folder at usr/lib/python3/dist-packages/plantcv/plantcv.

There is clearly some comprehension here that I am missing, as I have a similar problem for two packages now. Please, Internet. Help me understand what I am missing!

3
  • Did you try pip3 install scikit-image as per the installation docs? Commented Feb 10, 2018 at 13:52
  • What did you try? pip3 install -U scikit-image should install it for Python 3. Commented Feb 10, 2018 at 13:52
  • @AshishNitinPatil Yes, This is the message i get pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Collecting scikit-image Could not fetch URL pypi.python.org/simple/scikit-image: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping Could not find a version that satisfies the requirement scikit-image (from versions: ) No matching distribution found for scikit-image Commented Feb 10, 2018 at 15:35

1 Answer 1

1

You simply need to copy the folder in /usr/lib/python3/dist-packages/package-name

However, there are certain things that are specific to python packages. The folder named package name should be a valid package. A good indicator of that is it will contain a file "__init__.py". It is very likely that every sub-directory inside this package directory will contain a "__init__.py" file. It depends on whether there are modules inside these sub-directories.

In your code simply import the package like the following.

import package-name

where package-name can be skimage

Sign up to request clarification or add additional context in comments.

4 Comments

I have just checked and inside the package-name, there is another folder named package-name as a subdirectory. With the files you mentioned "init.py" Is it this folder only that I need to have in my dist-packages?
Also for plantcv if I use 'import plantcv' It imports fine, however, if I use help('modules') it does not appear in the modules list
both folders should have __init__.py in it. Try taking the inner folder out of the higher folder and paste that into /usr/lib/python3/dist-packages
for example if you have /usr/lib/python3/dist-packages/package-name/package-name/files_inside_package. Then change this scenario to where you will have something like this /usr/lib/python3/dist-packages/package-name/files_inside_package

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.