You are not logged in.

#1 2018-09-09 02:15:09

mbates
Member
Registered: 2014-07-09
Posts: 38

[SOLVED]How to downgrade python3.7 to python3.6

Hi,

python3.7 works fine except for tensorflow

## pip install tensorflow
Collecting tensorflow
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

And according to  https://github.com/tensorflow/tensorflow/issues/17022 , tensorflow does not properly support python3.7


I get the  python-3.6.6-1-x86_64.pkg.tar.xz  from https://archive.archlinux.org/packages/. By 

#sudo pacman -U python-3.6.6-1-x86_64.pkg.tar.xz

, I  could downgrade python3.7 to python3.6

However, I still cannot install tensorflow with python3.6

#pip install tensorflow
Traceback (most recent call last):
  File "/usr/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
ImportError: cannot import name 'load_entry_point'

even I cannot import pandas, which works fine with python3.7

$python
Python 3.6.6 (default, Jun 27 2018, 13:11:40) 
[GCC 8.1.1 20180531] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import pandas as pd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/pandas/__init__.py", line 23, in <module>
    from pandas.compat.numpy import *
  File "/usr/lib/python3.6/site-packages/pandas/compat/numpy/__init__.py", line 10, in <module>
    _np_version = np.__version__
AttributeError: module 'numpy' has no attribute '__version__'

I try to uninstall pip and reinstall it.

sudo pacman -Rs python-pip
sudo pacman -S python-pip

No luck

I am not sure if there is something wrong with my system, or I used the wrong way to downgrade python.

How should I downgrade python to 3.6 correctly and install tensorflow?

Last edited by mbates (2018-09-11 05:19:56)

Offline

#2 2018-09-09 03:28:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: [SOLVED]How to downgrade python3.7 to python3.6

A partial downgrade is equivalent to a partial upgrade and unsupported for the very reasons you are seeing - you will break everything that depends on python.

Tensor flow is in the repos, does that not work with python3.7?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#3 2018-09-09 05:11:41

mbates
Member
Registered: 2014-07-09
Posts: 38

Re: [SOLVED]How to downgrade python3.7 to python3.6

Trilby wrote:

A partial downgrade is equivalent to a partial upgrade and unsupported for the very reasons you are seeing - you will break everything that depends on python.

Tensor flow is in the repos, does that not work with python3.7?

As showed in https://github.com/tensorflow/tensorflow/issues/17022, git tensorflow does not work with python3.7

Hello ciribellialvaro, I couldn't import tensorflow too so I download python 3.6 and everything is fine now

I think downgrading python is equivalent to

sudo pacman -Syu --ignore=python

Offline

#4 2018-09-09 05:57:09

mcmillan
Member
Registered: 2006-04-06
Posts: 737

Re: [SOLVED]How to downgrade python3.7 to python3.6

mbates wrote:

I think downgrading python is equivalent to

sudo pacman -Syu --ignore=python

which is a partial update, and as Trilby pointed out likely to break things. If you really need to have python3.6, have you tried installing the AUR package?

https://aur.archlinux.org/packages/python36

Offline

#5 2018-09-09 07:59:39

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

Re: [SOLVED]How to downgrade python3.7 to python3.6

mbates wrote:
Trilby wrote:

A partial downgrade is equivalent to a partial upgrade and unsupported for the very reasons you are seeing - you will break everything that depends on python.

Tensor flow is in the repos, does that not work with python3.7?

As showed in https://github.com/tensorflow/tensorflow/issues/17022, git tensorflow does not work with python3.7

That wasn't the question.

Did you try installing the tensorflow in the repos, before attempting to compile it yourself?

Given, that Arch Linux provides python3.7 exclusively, and we also provide tensorflow, it would stand to reason that we got tensorflow to work with python3.7... right?
Assuming, that you actually do what you're supposed to do and install it with pacman!

Stop doing weird things. The official repositories exist for good reason -- we've put *considerable* effort into making things work even when upstream didn't.


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

Offline

#6 2018-09-09 15:38:57

mbates
Member
Registered: 2014-07-09
Posts: 38

Re: [SOLVED]How to downgrade python3.7 to python3.6

mcmillan wrote:
mbates wrote:

I think downgrading python is equivalent to

sudo pacman -Syu --ignore=python

which is a partial update, and as Trilby pointed out likely to break things. If you really need to have python3.6, have you tried installing the AUR package?

https://aur.archlinux.org/packages/python36

I will  consider it.

Offline

#7 2018-09-09 15:50:37

mbates
Member
Registered: 2014-07-09
Posts: 38

Re: [SOLVED]How to downgrade python3.7 to python3.6

Eschwartz wrote:

That wasn't the question.

Did you try installing the tensorflow in the repos, before attempting to compile it yourself?

Given, that Arch Linux provides python3.7 exclusively, and we also provide tensorflow, it would stand to reason that we got tensorflow to work with python3.7... right?
Assuming, that you actually do what you're supposed to do and install it with pacman!

Stop doing weird things. The official repositories exist for good reason -- we've put *considerable* effort into making things work even when upstream didn't.

As you suggested, after

sudo pacman -S tensorflow

  I get

Python 3.7.0 (default, Jul 15 2018, 10:44:58) 
[GCC 8.1.1 20180531] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'

Then I tried to install  python-tensorflow

sudo pacman -S python-tensorflow 
...
...
python-numpy: /usr/lib/python3.7/site-packages/numpy/tests/test_numpy_version.py exists in filesystem
python-numpy: /usr/lib/python3.7/site-packages/numpy/tests/test_reloading.py exists in filesystem
python-numpy: /usr/lib/python3.7/site-packages/numpy/tests/test_scripts.py exists in filesystem
python-numpy: /usr/lib/python3.7/site-packages/numpy/tests/test_warnings.py exists in filesystem
python-numpy: /usr/lib/python3.7/site-packages/numpy/version.py exists in filesystem
python-tensorflow: /usr/bin/freeze_graph exists in filesystem
python-tensorflow: /usr/bin/saved_model_cli exists in filesystem
python-tensorflow: /usr/bin/toco exists in filesystem
python-tensorflow: /usr/bin/toco_from_protos exists in filesystem
Errors occurred, no packages were upgraded.

So, after

pip uninstall numpy

,  I  tried to install  python-tensorflow again

# pacman -S python-tensorflow 
resolving dependencies...
looking for conflicting packages...

Packages (4) absl-py-0.4.1-1  python-numpy-1.15.1-1  python-protobuf-3.6.0.1-1  python-tensorflow-1.10.1-1

Total Installed Size:  258.10 MiB

:: Proceed with installation? [Y/n] y
(4/4) checking keys in keyring                                                   [##############################################] 100%
(4/4) checking package integrity                                                 [##############################################] 100%
(4/4) loading package files                                                      [##############################################] 100%
(4/4) checking for file conflicts                                                [##############################################] 100%
error: failed to commit transaction (conflicting files)
python-tensorflow: /usr/bin/freeze_graph exists in filesystem
python-tensorflow: /usr/bin/saved_model_cli exists in filesystem
python-tensorflow: /usr/bin/toco exists in filesystem
python-tensorflow: /usr/bin/toco_from_protos exists in filesystem
Errors occurred, no packages were upgraded.

Then 

# pacman -Rs freeze_graph saved_model_cli toco toco_from_protos
error: target not found: freeze_graph
error: target not found: saved_model_cli
error: target not found: toco
error: target not found: toco_from_protos

Those packages  should be installed from pip.  I think pacman and pip mess up things in /usr/bin, right?

Offline

#8 2018-09-09 15:55:05

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

Re: [SOLVED]How to downgrade python3.7 to python3.6

You what.

Those files come from *python-tensorflow*, and you have a conflicting version of *tensorflow installed from pip* in /usr/bin/

This is why you do not sudo pip things.

Remove what you installed via pip, and then once your /usr is clean, then you can successfully install python-tensorflow.


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

Offline

#9 2018-09-11 05:19:39

mbates
Member
Registered: 2014-07-09
Posts: 38

Re: [SOLVED]How to downgrade python3.7 to python3.6

Eschwartz wrote:

Those files come from *python-tensorflow*, and you have a conflicting version of *tensorflow installed from pip* in /usr/bin/

This is why you do not sudo pip things.

Youre right.
The python packages installed by the  pacman would be listed by pip list.  After weeks or months, I will forget which way I used.  And it is not a good thing to uninstall packages installed from pacman  by pip.

Eschwartz wrote:

Remove what you installed via pip, and then once your /usr is clean, then you can successfully install python-tensorflow.

After uninstalling tons of packages from pips,  there are still orphans there

error: target not found: freeze_graph
error: target not found: saved_model_cli
error: target not found: toco
error: target not found: toco_from_protos

I just rm -fr them.

Finally, pip is clean. And I installed all those python packsge by pacman. Right now, everything works well.

Thanks for your help.

Offline

Board footer

Powered by FluxBB