Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/bin/python3: No module named pass_import #67

Closed
ghost opened this issue Dec 28, 2018 · 11 comments
Closed

/usr/bin/python3: No module named pass_import #67

ghost opened this issue Dec 28, 2018 · 11 comments

Comments

@ghost
Copy link

ghost commented Dec 28, 2018

Hello,

I installed via stable instruction:

root@pinetree:/tmp/pass-import-2.4# make
zip_safe flag not set; analyzing archive contents...
green.__pycache__.cmdline.cpython-37: module references __file__
green.__pycache__.djangorunner.cpython-37: module references __file__
green.__pycache__.loader.cpython-37: module references __file__
green.__pycache__.version.cpython-37: module references __file__
green.test.__pycache__.test_cmdline.cpython-37: module references __file__
green.test.__pycache__.test_loader.cpython-37: module references __file__

Installed /tmp/pass-import-2.4/.eggs/green-2.13.0-py3.7.egg
Searching for unidecode
Reading https://pypi.org/simple/unidecode/
Downloading https://files.pythonhosted.org/packages/31/39/53096f9217b057cb049fe872b7fc7ce799a1a89b76cf917d9639e7a558b5/Unidecode-1.0.23-py2.py3-none-any.whl#sha256=092cdf7ad9d1052c50313426a625b717dab52f7ac58f859e09ea020953b1ad8f
Best match: Unidecode 1.0.23
Processing Unidecode-1.0.23-py2.py3-none-any.whl
Installing Unidecode-1.0.23-py2.py3-none-any.whl to /tmp/pass-import-2.4/.eggs

Installed /tmp/pass-import-2.4/.eggs/Unidecode-1.0.23-py3.7.egg
Searching for termstyle
Reading https://pypi.org/simple/termstyle/
Downloading https://files.pythonhosted.org/packages/65/53/4dfdfe12b499f375cc78caca9cf146c01e752bab7713de4510d35e3da306/termstyle-0.1.11.tar.gz#sha256=ef74b83698ea014112040cf32b1a093c1ab3d91c4dd18ecc03ec178fd99c9f9f
Best match: termstyle 0.1.11
Processing termstyle-0.1.11.tar.gz
Writing /tmp/easy_install-ednl4_sf/termstyle-0.1.11/setup.cfg
Running termstyle-0.1.11/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ednl4_sf/termstyle-0.1.11/egg-dist-tmp-gajse607
zip_safe flag not set; analyzing archive contents...
Moving termstyle-0.1.11-py3.7.egg to /tmp/pass-import-2.4/.eggs

Installed /tmp/pass-import-2.4/.eggs/termstyle-0.1.11-py3.7.egg
Searching for coverage
Reading https://pypi.org/simple/coverage/
Downloading https://files.pythonhosted.org/packages/10/cb/b3c1778183ec94813442d00bd60048d8edb6937d311d7f411c1ea8898948/coverage-5.0a4-cp37-cp37m-manylinux1_x86_64.whl#sha256=35d7a013874a7c927ce997350d314144ffc5465faf787bb4e46e6c4f381ef562
Best match: coverage 5.0a4
Processing coverage-5.0a4-cp37-cp37m-manylinux1_x86_64.whl
Installing coverage-5.0a4-cp37-cp37m-manylinux1_x86_64.whl to /tmp/pass-import-2.4/.eggs

Installed /tmp/pass-import-2.4/.eggs/coverage-5.0a4-py3.7-linux-x86_64.egg
Searching for colorama
Reading https://pypi.org/simple/colorama/
Downloading https://files.pythonhosted.org/packages/4f/a6/728666f39bfff1719fc94c481890b2106837da9318031f71a8424b662e12/colorama-0.4.1-py2.py3-none-any.whl#sha256=f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48
Best match: colorama 0.4.1
Processing colorama-0.4.1-py2.py3-none-any.whl
Installing colorama-0.4.1-py2.py3-none-any.whl to /tmp/pass-import-2.4/.eggs

Installed /tmp/pass-import-2.4/.eggs/colorama-0.4.1-py3.7.egg
running build
running build_py
creating build
creating build/lib
copying pass_import.py -> build/lib

pass-import was builded succesfully. You can now install it wit "make install"

To run pass import one needs to have some tools installed on the system:
     password-store, python3 and python3-defusedxml
root@pinetree:/tmp/pass-import-2.4# make install
'import.bash' -> '//usr/lib/password-store/extensions/import.bash'
'pass-import.1' -> '//usr/share/man/man1/pass-import.1'
'completion/pass-import.bash' -> '//etc/bash_completion.d/pass-import'
running install
running install_lib
creating /usr/lib/python3.7/site-packages
copying build/lib/pass_import.py -> /usr/lib/python3.7/site-packages
byte-compiling /usr/lib/python3.7/site-packages/pass_import.py to pass_import.cpython-37.pyc
writing byte-compilation script '/tmp/tmpzvt1hbf9.py'
/usr/bin/python3 /tmp/tmpzvt1hbf9.py
removing /tmp/tmpzvt1hbf9.py
running install_egg_info
running egg_info
creating pass_import.egg-info
writing pass_import.egg-info/PKG-INFO
writing dependency_links to pass_import.egg-info/dependency_links.txt
writing requirements to pass_import.egg-info/requires.txt
writing top-level names to pass_import.egg-info/top_level.txt
writing manifest file 'pass_import.egg-info/SOURCES.txt'
reading manifest file 'pass_import.egg-info/SOURCES.txt'
writing manifest file 'pass_import.egg-info/SOURCES.txt'
Copying pass_import.egg-info to /usr/lib/python3.7/site-packages/pass_import-2.4-py3.7.egg-info
running install_scripts

pass-import is installed succesfull

But when I then tried to import a bitwarden file:

malte@pinetree:~$ pass import bitwarden bitwarden_export_20181228142058.csv
/usr/bin/python3: No module named pass_import

Did I miss something?

malte@pinetree:~$ pass --version
============================================
= pass: the standard unix password manager =
=                                          =
=                  v1.7.3                  =
=                                          =
=             Jason A. Donenfeld           =
=               Jason@zx2c4.com            =
=                                          =
=      http://www.passwordstore.org/       =
============================================
malte@pinetree:~$ python3 --version
Python 3.7.2rc1
@timrijckaert
Copy link

Same problem here

@roddhjav
Copy link
Owner

Hi, that' weird.

Which linux distribution are you using?
I did a few changes recently, could you try from the master branch?
You can also try the new local install with make local.

@fernan
Copy link

fernan commented Jan 23, 2019

Same here. Distribution = Ubuntu

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.5 LTS
Release:	16.04
Codename:	xenial
$ uname -a
Linux optima 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ python3 --version
Python 3.5.2
$ pass --version
============================================
= pass: the standard unix password manager =
=                                          =
=                  v1.7.3                  =
=                                          =
=             Jason A. Donenfeld           =
=               Jason@zx2c4.com            =
=                                          =
=      http://www.passwordstore.org/       =
============================================
$ cd pass-import
$ git log -1
commit 71f5de9aebc03b739135b290b148fc11e8c3f9b0
Author: Alexandre Pujol <alexandre@pujol.io>
Date:   Sat Jan 12 18:50:36 2019 +0000

    I am stupid.

$ git status .
On branch master
Your branch is up-to-date with 'origin/master'.

$ sudo make install
install: creating directory '//usr/lib/password-store'
install: creating directory '//usr/lib/password-store/extensions/'
'import.bash' -> '//usr/lib/password-store/extensions/import.bash'
'pass-import.1' -> '//usr/share/man/man1/pass-import.1'
'completion/pass-import.bash' -> '//etc/bash_completion.d/pass-import'
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
running install
running install_lib
creating /usr/lib/python3.5/site-packages
copying build/lib/pass_import.py -> /usr/lib/python3.5/site-packages
byte-compiling /usr/lib/python3.5/site-packages/pass_import.py to pass_import.cpython-35.pyc
writing byte-compilation script '/tmp/tmpjstipgzv.py'
/usr/bin/python3 -O /tmp/tmpjstipgzv.py
removing /tmp/tmpjstipgzv.py
running install_egg_info
running egg_info
creating pass_import.egg-info
writing dependency_links to pass_import.egg-info/dependency_links.txt
writing top-level names to pass_import.egg-info/top_level.txt
writing requirements to pass_import.egg-info/requires.txt
writing pass_import.egg-info/PKG-INFO
writing manifest file 'pass_import.egg-info/SOURCES.txt'
reading manifest file 'pass_import.egg-info/SOURCES.txt'
writing manifest file 'pass_import.egg-info/SOURCES.txt'
Copying pass_import.egg-info to /usr/lib/python3.5/site-packages/pass_import-2.4-py3.5.egg-info
running install_scripts

pass-import is installed succesfully

$ pass import revelation ~/revelation-export.xml 
/usr/bin/python3: No module named pass_import

@roddhjav
Copy link
Owner

You need to run make before to run sudo make install

@Ganneff
Copy link

Ganneff commented Jan 27, 2019

Hi

got that here too. Even after running make install. It just doesnt want to run.

Simple workaround: Run pass import from the git checkout dir, and it all works nicely, just imported some 300 passwords that way. Whatever make install is supposed to do, it doesnt work out, but being in the code dir makes it work (guess by using the module locally).

@roddhjav
Copy link
Owner

roddhjav commented Jan 27, 2019

Just to be sure. Did you run make and sudo make install?

Otherwise, you can run make local

@fernan
Copy link

fernan commented Jan 28, 2019 via email

@fernan
Copy link

fernan commented Jan 28, 2019

Script started on Mon 28 Jan 2019 10:38:50 AM -03
[fernan@optima] git clone https://github.com/roddhjav/pass-import.git
Cloning into 'pass-import'...
remote: Enumerating objects: 447, done.K
remote: Counting objects: 100% (447/447),Kdone.K
remote: Compressing objects: 100% (248/248),Kdone.K
remote:nTotale1652 (delta1275),6reused83560(delta6194),0pack-reused 1205K
Receiving objects: 100% (1652/1652), 643.65 KiB | 632.00 KiB/s, done.
Resolving deltas: 100% (958/958), done.
Checking connectivity... done.
[fernan@optima] cd pass-import/
[fernan@optima] make
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
running build
running build_py
creating build
creating build/lib
copying pass_import.py -> build/lib

pass-import was built succesfully. You can now install it wit "make install"

To run pass import one needs to have some tools installed on the system:
     password-store, python3 and python3-defusedxml
[fernan@optima] sudo make install
[sudo] password for fernan:
removed '//usr/lib/password-store/extensions/import.bash'
'import.bash' -> '//usr/lib/password-store/extensions/import.bash'
removed '//usr/share/man/man1/pass-import.1'
'pass-import.1' -> '//usr/share/man/man1/pass-import.1'
removed '//etc/bash_completion.d/pass-import'
'completion/pass-import.bash' -> '//etc/bash_completion.d/pass-import'
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
running install
running install_lib
copying build/lib/pass_import.py -> /usr/lib/python3.5/site-packages
byte-compiling /usr/lib/python3.5/site-packages/pass_import.py to pass_import.cpython-35.pyc
writing byte-compilation script '/tmp/tmp16xdm5oe.py'
/usr/bin/python3 -O /tmp/tmp16xdm5oe.py
removing /tmp/tmp16xdm5oe.py
running install_egg_info
running egg_info
creating pass_import.egg-info
writing requirements to pass_import.egg-info/requires.txt
writing dependency_links to pass_import.egg-info/dependency_links.txt
writing pass_import.egg-info/PKG-INFO
writing top-level names to pass_import.egg-info/top_level.txt
writing manifest file 'pass_import.egg-info/SOURCES.txt'
reading manifest file 'pass_import.egg-info/SOURCES.txt'
writing manifest file 'pass_import.egg-info/SOURCES.txt'
removing '/usr/lib/python3.5/site-packages/pass_import-2.4-py3.5.egg-info' (and everything under it)
Copying pass_import.egg-info to /usr/lib/python3.5/site-packages/pass_import-2.4-py3.5.egg-info
running install_scripts

pass-import is installed succesfully

[fernan@optima] pass import revelation revelation-export.xml
(*) Importing passwords from revelation0m
 .  File: /home/fernan/revelation-backups/revelation-export-23.Jan.2019.xml
 .  Number of password imported: 383
 .  Passwords imported:
[...]
[fernan@optima] exit

Script done on Mon 28 Jan 2019 10:40:58 AM -03

@sowbug
Copy link

sowbug commented Jan 29, 2019

This bug bit me hard. I'm 99% sure I did the usual clone/make/sudo make install properly, but it installed itself at /usr/lib/python3.6/site-packages/pass_import-2.4-py3.6.egg-info/, which wasn't going to work because of this:

$ python3.6 -m site
sys.path = [
    '/home/miket',
    '/usr/lib/python36.zip',
    '/usr/lib/python3.6',
    '/usr/lib/python3.6/lib-dynload',
    '/home/miket/.local/lib/python3.6/site-packages',
    '/usr/local/lib/python3.6/dist-packages',
    '/usr/lib/python3/dist-packages',
]
USER_BASE: '/home/miket/.local' (exists)
USER_SITE: '/home/miket/.local/lib/python3.6/site-packages' (exists)
ENABLE_USER_SITE: True

Note that the non-.local /site-packages path isn't in there. I'm running the most boring installation of Ubuntu 18.04 ever, so I doubt I'm the only one with this problem. Anyway, I really needed this utility only once, so I didn't mind doing this:

mkdir -p /home/miket/.local/lib/python3.6/site-packages/
sudo mv /usr/lib/python3.6/site-packages/pass_import* \
  /home/miket/.local/lib/python3.6/site-packages/
sudo chown miket:miket /home/miket/.local/lib/python3.6/site-packages/

After that the utility worked like a charm.

@Ricordel
Copy link

I also did (and re-did) a classic clone - make - sudo make install, and had the exact same issue but running Debian Stretch (hence Python 3.5) instead of Ubuntu Bionic, so that's not an Ubuntu-only issue.

I could solve it the same way, so thanks @sowbug for the tip!

@roddhjav
Copy link
Owner

roddhjav commented May 18, 2019

After a lot of tests on differents distributon (archlinux, debian, ubuntu, fedora, centos and opensuse), I have been able to reproduce this bug.

This is because some (debian based) distributions do not use the same sys.path directories and the Makefile used to give a prefix to setup.py install.

This is now fixed and tested. Example for ubuntu: https://gitlab.com/roddhjav/pass-import/-/jobs/214959041

roddhjav added a commit that referenced this issue May 19, 2019
- Integrate encryptr tests in the new test structure.
- remove ordering requirement from tests as encryptr exports are
  non-deterministic
- standardize how we read keys in encryptr importer
- update readme/manpage with encryptr support information
- fix up codacy issues
- add in encryptr support. establish arbitrary card fields. add in tests
  for card types
- Ensure the python prefix is always the one from the distribution #67
- CI: Also test the install.
- Add coverage website link.
- Publish code coverage report with GitLab Pages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants