You are not logged in.

#1 2018-07-14 17:18:41

louic
Member
Registered: 2013-06-13
Posts: 15

How to install the latest version of Python + libraries? [ SOLVED ]

What is the best way to install the latest version of python with the latest versions of numpy, scipy, pandas, etc. before it shows up in the official package repo?

- Is there a good (standard?) procedure to set up a separate development environment with the latest python version and modules?
- Should I use a PKGBUILD for everything, or pip install?

Last edited by louic (2018-07-14 20:00:41)

Offline

#2 2018-07-14 17:26:32

gugah
Member
Registered: 2013-01-02
Posts: 63

Re: How to install the latest version of Python + libraries? [ SOLVED ]

Hi,
Current Python 3.x version in the official packages is 3.6.6. Unless you really need Python 3.7.0, I'll stay with this version until 3.7 is stable enough for Arch. I usually install python-virtualenv on my system and run

$ virtualenv env_name
$ source env_name/bin/activate

Once on my new environment install latest versions of numpy, scipy, tensorflow, etc using pip without touching my default python install.
(python2-virtualenv is also helpful when I wanna setup a Python 2.7 environment).

tldr: I think the best way to use python on your system is via pip install on new environments so as not to alter the default installation. The only package you'll need for this is python-virtualenv

Last edited by gugah (2018-07-14 17:29:33)


"The problem with quotes on the Internet is that it is hard to verify their authenticity." ~ Abraham Lincoln

Offline

#3 2018-07-14 20:00:23

louic
Member
Registered: 2013-06-13
Posts: 15

Re: How to install the latest version of Python + libraries? [ SOLVED ]

Ok, thanks for the answer, marking as solved.
I will see if I can set that all up and make it work with jupyter.

Why python 3.7? Mostly because I want to play with the new dataclasses. Other than that, I often find that I need sklearn or pandas features that are not yet available in the stable version.

Offline

#4 2018-07-15 00:09:36

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 713

Re: How to install the latest version of Python + libraries? [ SOLVED ]

gugah wrote:

I usually install python-virtualenv on my system and run

$ virtualenv env_name
$ source env_name/bin/activate

I don't understand why people continue to use and suggest 3rd party virtualenv when that functionality has been built in to python since 3.3. Just use native python:

$ python -m venv env_name
$ source env_name/bin/activate

Offline

#5 2018-07-15 00:40:56

rdeckard
Wiki Maintainer
Registered: 2015-01-28
Posts: 137

Re: How to install the latest version of Python + libraries? [ SOLVED ]

My understanding is that you can't actually install a virtual environment with a version of python that isn't installed on your system already. I am unable to actually make any of the solutions in this thread work to get python 3.7 in a virtual environment.

Offline

#6 2018-07-15 01:09:30

progandy
Member
Registered: 2012-05-17
Posts: 5,312

Re: How to install the latest version of Python + libraries? [ SOLVED ]

The python37 in the AUR looks like it might work side by side with the default python package. Then create a virtual env with the "python3.7" binary.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#7 2018-07-15 04:04:51

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: How to install the latest version of Python + libraries? [ SOLVED ]

We have no reason to think python 3.7 is not stable enough, the problem is with other software that depends on it. tongue

Currently, Arch Linux is rebuilding the entire python ecosystem with python 3.7, but some packages require more than a simple rebuild. The current build list is tracked at https://rebuilds.foutrelis.com/ and failing packages at https://www.archlinux.org/todo/python-3 … -failures/ while we sort things out.

Once we've successfully rebuilt everything it will leave the staging repos and move to testing.

You can hasten the speed of this occurring, by helping to debug and patch any issues. smile Upstream bug reports, or, even better, upstream pull requests, would be great!


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#8 2018-07-15 12:11:40

louic
Member
Registered: 2013-06-13
Posts: 15

Re: How to install the latest version of Python + libraries? [ SOLVED ]

So this is what I did. It seems to work great (at least for now).
Python has its own mechanism for a slotted install as described in the readme file that comes with the download.

Let me know if you have any comments, eg. if there is a better way to do this.

# install python 3.7
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar xf Python-3.7.0.tar.xz
cd Python-3.7.0
./configure
make profile-opt
sudo make altinstall  # installs python in /usr/local/bin/python3.7

# install jupyter notebook kernel
sudo cp -r /usr/share/jupyter/kernels/python3 /usr/share/jupyter/kernels/python3.7
vim /usr/share/jupyter/kernels/python3.7/kernel.json  # change directory of python installation and display_name

# create and activate new environment
python3.7 -m venv env_name
source env_name/bin/activate

Instead of using a virtual environment, pip3.7 can be used to install system-wide packages for this python version.
These then become available to the jupyter kernel as installed above. Alternatively, it is possible to create a jupyter kernel of a virtual environment.

Last edited by louic (2018-07-15 12:18:36)

Offline

Board footer

Powered by FluxBB