Install extra Python stuff

I’m running OpenSUSE Leap 15.2 on my workstation and my laptop.

I have a handful of Python applications that don’t seem to be available in any of the repositories:

  • speedtest
  • mkdocs
  • mkdocs-material

And that’s it.

To install these and make them work, I did what I’m not supposed to do:

# pip install --upgrade pip
# pip install speedtest
# pip install mkdocs
# pip install mkdocs-material

And this works. Though there’s blog articles galore that tell me I should never ever run pip as root (and I also understand why).

But…

… none of these articles explain in a clear and concise manner how exactly I’m supposed to install these extra packages in a clean manner without having to jump through burning loops.

Any helpful suggestions as to how to install this extra Python stuff in an orthodox manner ? (Please explain the details. “Just setup a virtual environment” is not an explanation.)

Cheers,

Niki

Hi Niki,

I can’t tell anything about pip, but there’s a couple of community repositories that seem to provide what you are looking for:
https://software.opensuse.org/search?utf8=✓&baseproject=ALL&q=mkdocs
https://software.opensuse.org/search?utf8=✓&baseproject=ALL&q=speedtest

Package names seem to be dedicated to the Python version. So you have to choose if / which one you may use.

kasi

I am a novice python person. Others likely have more insights into this than me.

But, for those needed python files that aren’t available from opensuse repo packages (using Yast or zypper) use the “pip install” command as a user. This installs the needed packages into user directories. The files go into /home/user/.local/lib and into python subdirectories for each python version. You can override this location and put them where you want.

The files are used by python as you import theminto your code and they can come from either system python files or user python files. I have found no conflicts between the two sets of files. If there is a problem importing a user python file, it might be necessary to add python environment statements into .bashrc. This is searchable on python sites. I have not found that to be needed.

I have seen many warnings against using pip as root. I guess things can get really mixed up. I have seen no need to do that.

tom kosvic

You were able to install the packages (“pip install”), what is it you still need to install?

If you python can not somehow find these packages, try adding the base directory where theses packages are installed in the PYTHONPATH environment variable to your startup script.

So, I experimented some more with Python and Pip, and I wrote a little article about setting up a virtual environment for Python.

https://docs.microlinux.fr/lp152/python-venv/

Any suggestions ?

Hi
Package as an rpm and use the openSUSE Build Service and py2pack to prepare (or just build locally)…

For example;


py2pack generate mkdocs

Grab the source tarball and good to go…