You are not logged in.

#1 2018-11-04 13:13:34

huzo11
Member
Registered: 2018-10-31
Posts: 60

Installing a specific version of python (3.6)

Hello all,

A newbie here. So, I wanted to install the Tensorflow package. However, Tensorflow is not compatible with python's latest version yet (3.7). Therefore, I need to downgrade my python version. What I intended to do was to remove python and install python 3.6's from AUR. But the problem is that, since it is an obsolete version, the AUR package name is python36 instead of python. And this would cause problems in pip installing python packages. So, is it possible to install python 3.6 and with the package name "python"? (python --version should output 3.6). 

Thanks.


Be nice and live for others.
https://prismatically.blog

Offline

#2 2018-11-04 13:22:11

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Installing a specific version of python (3.6)

Why not use the (python-)tensorflow package from [community]? That seems to be patched to work with Python 3.7.

Offline

#3 2018-11-04 13:30:36

huzo11
Member
Registered: 2018-10-31
Posts: 60

Re: Installing a specific version of python (3.6)

Raynman wrote:

Why not use the (python-)tensorflow package from [community]? That seems to be patched to work with Python 3.7.

The thing is, when I do that, after importing tensorflow I get an error:
"Error importing tensorflow.  Unless you are using bazel,you should not try to import tensorflow from its source directory;please exit the tensorflow source tree, and relaunch your python interpreterfrom there."
After doing my research, I realized that the only solution is to downgrade python.
One thing I do not understand is, why is it so hard to downgrade it? It is as if we are forced to use the latest version only.

Thanks


Be nice and live for others.
https://prismatically.blog

Offline

#4 2018-11-04 13:39:06

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: Installing a specific version of python (3.6)

One thing I do not understand is, why is it so hard to downgrade it? It is as if we are forced to use the latest version only.

That's common practice for archlinux.


https://wiki.archlinux.org/index.php/Fr … itories.3F


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2018-11-04 15:02:32

stloma
Member
Registered: 2018-11-04
Posts: 4

Re: Installing a specific version of python (3.6)

Can you just run python36 from the AUR? I have 3.5, 3.6, and 3.7 installed on my machine using packages with no problem.

Unless TensorFlow is just trying to use 'python3', I suppose it wouldn't work.

Last edited by stloma (2018-11-04 15:04:24)

Offline

#6 2018-11-04 15:03:54

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

Re: Installing a specific version of python (3.6)

huzo11 wrote:
Raynman wrote:

Why not use the (python-)tensorflow package from [community]? That seems to be patched to work with Python 3.7.

The thing is, when I do that, after importing tensorflow I get an error:
"Error importing tensorflow.  Unless you are using bazel,you should not try to import tensorflow from its source directory;please exit the tensorflow source tree, and relaunch your python interpreterfrom there."

It seems to work for other people, so you will need to provide a better description than this or we cannot help you debug it...

FWIW, if I install the python-tensorflow package and then run "import tensorflow" in a python interpreter, it works fine. This seems to be what you said causes an error, so it would seem the error is specific to your Arch installation. Maybe you have a bad copy of tensorflow in ~/.local/lib/python3.7 or you accidentally ran it from within a source code checkout?

After doing my research, I realized that the only solution is to downgrade python.

What research? Again, care to share your sources of information so that this thread doesn't become a dead end?

One thing I do not understand is, why is it so hard to downgrade it? It is as if we are forced to use the latest version only.

Thanks

It's not at all hard to install a python3.6 interpreter and explicitly use that. It is, however, impossible to downgrade a major component of software which is used in *many* other packages, all of which are built against python3.7.

What exactly is so hard with, in the worst-case scenario, installing the python36 package and doing all your tensorflow work in a venv?


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

Offline

#7 2018-11-04 15:46:22

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: Installing a specific version of python (3.6)

You may want to look at https://wiki.archlinux.org/index.php/Py … nvironment
Set up a virtual environment,  You can also set up a local version of Python for that environment  that negatively impact the rest of your Arch System. 

I have come to really enjoy coding in Python.  I note that its Achilles's heal seems to be negative interactions between various interpreter versions and modules that depend modules that depend on specific versions of things.  Hence, big projects often go through the same hoops that Node projects have to jump through -- living in a big virtual environment and downloading local copies of things for that specific environment.

When I code Python in Arch, it is such a pleasure that it Just Works™.  We can thank our devs and TUs for the tremendous work they do on that.  Try to find a way to do this the Arch way before resorting to a venv.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2018-11-04 16:20:36

huzo11
Member
Registered: 2018-10-31
Posts: 60

Re: Installing a specific version of python (3.6)

eschwartz wrote:
huzo11 wrote:
Raynman wrote:

Why not use the (python-)tensorflow package from [community]? That seems to be patched to work with Python 3.7.

The thing is, when I do that, after importing tensorflow I get an error:
"Error importing tensorflow.  Unless you are using bazel,you should not try to import tensorflow from its source directory;please exit the tensorflow source tree, and relaunch your python interpreterfrom there."

It seems to work for other people, so you will need to provide a better description than this or we cannot help you debug it...

FWIW, if I install the python-tensorflow package and then run "import tensorflow" in a python interpreter, it works fine. This seems to be what you said causes an error, so it would seem the error is specific to your Arch installation. Maybe you have a bad copy of tensorflow in ~/.local/lib/python3.7 or you accidentally ran it from within a source code checkout?

After doing my research, I realized that the only solution is to downgrade python.

What research? Again, care to share your sources of information so that this thread doesn't become a dead end?

One thing I do not understand is, why is it so hard to downgrade it? It is as if we are forced to use the latest version only.

Thanks

It's not at all hard to install a python3.6 interpreter and explicitly use that. It is, however, impossible to downgrade a major component of software which is used in *many* other packages, all of which are built against python3.7.

What exactly is so hard with, in the worst-case scenario, installing the python36 package and doing all your tensorflow work in a venv?

Hello, thank you for your responses. I apologize if I have disrespected the forum's tradition. However, I am relatively new to Arch and this forum. But I am willing to learn and get more familiar with the overall architecture.   

To explain things clearly, I first installed python via pacman (v 3.7). And then installed tensorflow too via pacman. In a python interpreter, when I tried importing tensorflow, I encountered the error above. When I searched it, and looked at https://github.com/tensorflow/tensorflow/issues/1402 I tried upgrading protobuf but than did not change anything. And in some other posted github issue that I could not find now, some people solved the issue by downgrading. Deleting the tensorflow package from pacman and trying to install from pip does not work because it gives the error: "Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow"

To be honest, the reason I want to downgrade the "python" package is because I am confused about how I can use all the python packages installed via pip (numpy, matplotlib etc.) in python36. So, I would be very happy if you could elaborate more or maybe share a link on how I can do so.

Thanks!


Be nice and live for others.
https://prismatically.blog

Offline

#9 2018-11-04 16:26:18

huzo11
Member
Registered: 2018-10-31
Posts: 60

Re: Installing a specific version of python (3.6)

ewaller wrote:

You may want to look at https://wiki.archlinux.org/index.php/Py … nvironment
Set up a virtual environment,  You can also set up a local version of Python for that environment  that negatively impact the rest of your Arch System. 

I have come to really enjoy coding in Python.  I note that its Achilles's heal seems to be negative interactions between various interpreter versions and modules that depend modules that depend on specific versions of things.  Hence, big projects often go through the same hoops that Node projects have to jump through -- living in a big virtual environment and downloading local copies of things for that specific environment.

When I code Python in Arch, it is such a pleasure that it Just Works™.  We can thank our devs and TUs for the tremendous work they do on that.  Try to find a way to do this the Arch way before resorting to a venv.

Sounds insightful. But I am confused with some parts. What do you mean by "set up a local version of Python for that environment  that negatively impact the rest of your Arch System."?

And may I also ask what you meant by saying "trying to find a way to do it in the Arch way"? What makes it different from a venv? And why do you consider venv as a last resort instead of a solution? 

Thanks!


Be nice and live for others.
https://prismatically.blog

Offline

#10 2018-11-04 16:49:55

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: Installing a specific version of python (3.6)

huzo11 wrote:
ewaller wrote:

You may want to look at https://wiki.archlinux.org/index.php/Py … nvironment
Set up a virtual environment,  You can also set up a local version of Python for that environment  that negatively impact the rest of your Arch System. 

I have come to really enjoy coding in Python.  I note that its Achilles's heal seems to be negative interactions between various interpreter versions and modules that depend modules that depend on specific versions of things.  Hence, big projects often go through the same hoops that Node projects have to jump through -- living in a big virtual environment and downloading local copies of things for that specific environment.

When I code Python in Arch, it is such a pleasure that it Just Works™.  We can thank our devs and TUs for the tremendous work they do on that.  Try to find a way to do this the Arch way before resorting to a venv.

Sounds insightful. But I am confused with some parts. What do you mean by "set up a local version of Python for that environment  that negatively impact the rest of your Arch System."?

And may I also ask what you meant by saying "trying to find a way to do it in the Arch way"? What makes it different from a venv? And why do you consider venv as a last resort instead of a solution? 

Thanks!

Because I left out a bunch of words.  Sorry -- just started my first cup of coffee this beautiful fall morning.

I should have said "set up a local version of Python for that environment  that does not negatively impact the rest of your Arch System"
As to the Arch Way,  in this case, I mean by using packages that have been developed, vetted and patched to work together as a system.  If I use Arch packages (and to a lesser degree AUR) I can be certain that if i import a library, it will work with all of the other components that are installed.  When I have done Python development on Debian or Windows, I found myself having to corral all my components I needed for each and every project.  For example, I might find that pypy modules that provide serial ports might not work with the version of CherryPy that is installed.  I would have to research and find modules that were compatible and bundle them in the same virtual environment.  Kind of what you are going through with tensor-flow.  This is also why we discourage the uses of pip to install system wide stuff on arch; it often breaks things. 

So, pick a method.  Use things in the Arch repositories and AUR, or use a virtual environment and pip; but only install from pip for the user, not system wide.

Last edited by ewaller (2018-11-04 16:50:32)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#11 2018-11-06 12:46:53

huzo11
Member
Registered: 2018-10-31
Posts: 60

Re: Installing a specific version of python (3.6)

ewaller wrote:
huzo11 wrote:
ewaller wrote:

You may want to look at https://wiki.archlinux.org/index.php/Py … nvironment
Set up a virtual environment,  You can also set up a local version of Python for that environment  that negatively impact the rest of your Arch System. 

I have come to really enjoy coding in Python.  I note that its Achilles's heal seems to be negative interactions between various interpreter versions and modules that depend modules that depend on specific versions of things.  Hence, big projects often go through the same hoops that Node projects have to jump through -- living in a big virtual environment and downloading local copies of things for that specific environment.

When I code Python in Arch, it is such a pleasure that it Just Works™.  We can thank our devs and TUs for the tremendous work they do on that.  Try to find a way to do this the Arch way before resorting to a venv.

Sounds insightful. But I am confused with some parts. What do you mean by "set up a local version of Python for that environment  that negatively impact the rest of your Arch System."?

And may I also ask what you meant by saying "trying to find a way to do it in the Arch way"? What makes it different from a venv? And why do you consider venv as a last resort instead of a solution? 

Thanks!

Because I left out a bunch of words.  Sorry -- just started my first cup of coffee this beautiful fall morning.

I should have said "set up a local version of Python for that environment  that does not negatively impact the rest of your Arch System"
As to the Arch Way,  in this case, I mean by using packages that have been developed, vetted and patched to work together as a system.  If I use Arch packages (and to a lesser degree AUR) I can be certain that if i import a library, it will work with all of the other components that are installed.  When I have done Python development on Debian or Windows, I found myself having to corral all my components I needed for each and every project.  For example, I might find that pypy modules that provide serial ports might not work with the version of CherryPy that is installed.  I would have to research and find modules that were compatible and bundle them in the same virtual environment.  Kind of what you are going through with tensor-flow.  This is also why we discourage the uses of pip to install system wide stuff on arch; it often breaks things. 

So, pick a method.  Use things in the Arch repositories and AUR, or use a virtual environment and pip; but only install from pip for the user, not system wide.

I have solved the issue by creating a venv for python36 and installing tensorflow and all the other python packages in that venv. However, I would also like to ask the way to prevent installing packages to the venv? For instance, if I wanted to install the latest python to my system but I don't want it to be installed inside the venv. When doing pacman -S python, it installs it in the virtual environments too. Any suggestions?

Thanks!


Be nice and live for others.
https://prismatically.blog

Offline

#12 2018-11-06 12:59:07

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: Installing a specific version of python (3.6)

venvd links to system python, virtualenv not: https://wiki.archlinux.org/index.php/Py … n_versions

Offline

#13 2018-11-06 13:07:12

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

Re: Installing a specific version of python (3.6)

python3.6 -m venv --help
python3.6 -m venv --copies /path/to/venv

A virtual environment created with symlinks and the "python36" package should not change if you update the python package, though. The symlinks should point to the "python3.6" binary instead of "python" or "python3".

Last edited by progandy (2018-11-06 13:09:43)


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

Offline

Board footer

Powered by FluxBB