opengisch / pum

Postgres Upgrades Manager
GNU General Public License v2.0
30 stars 7 forks source link

Import yaml error on pum #47

Closed ponceta closed 5 years ago

ponceta commented 5 years ago

I can't launch pum commands

pum -v

tells me he can't find yaml Module

ModuleNotFoundError: No module named 'yaml'

Pum version 0.7.1 Pyyaml version 3.13

Python version 3.6.7 on Ubuntu 18.04.1 LTS

Virtual env is used for python 3

pum and pyyaml have been updated using

sudo pip3 install pum --upgrade sudo pip3 install pyyaml --upgrade

There's a strange message about rights below, this is maybe the main reason why all of this is broken:

The directory '/home/pulmexa/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

???

3nids commented 5 years ago

you should not pip install with raw sudo. Use -H as said in message.

ponceta commented 5 years ago

I cleaned pum and pyyaml using pip3 uninstall and reinstalled

sudo -H pip3 uninstall pum

sudo -H pip3 install pum

(tutorial-env) pulmexa@ubuntu:~/qgep_sigip$ sudo -H pip3 install pum
Collecting pum
  Downloading https://files.pythonhosted.org/packages/d1/a7/268d12148a82fa00f541d113d50004a76ae22a44e7a56066e125a06bddd8/pum-0.7.1.tar.gz
Collecting PyYAML (from pum)
Requirement already satisfied: psycopg2-binary>=2.7.3 in /usr/local/lib/python3.6/dist-packages (from pum)
Building wheels for collected packages: pum
  Running setup.py bdist_wheel for pum ... done
  Stored in directory: /root/.cache/pip/wheels/f6/60/9d/37f975164b74c703f63ffbe1d25c28a21df1de712c842ec2c3
Successfully built pum
Installing collected packages: PyYAML, pum
Successfully installed PyYAML-3.13 pum-0.7.1

launching a python3 console still result in :

Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'yaml'
ponceta commented 5 years ago

Solved... Ubuntu 18.04.1 LTS has python3 by default, no more need for venv!