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

ImportError: No module named gmv.gmv_cmd #44

Closed
manuelmeurer opened this issue May 25, 2012 · 12 comments
Closed

ImportError: No module named gmv.gmv_cmd #44

manuelmeurer opened this issue May 25, 2012 · 12 comments

Comments

@manuelmeurer
Copy link

Getting this after installing via pip:

> gmvault sync foo.bar@gmail.com
Odd. Use default python2.7.x distribution
Traceback (most recent call last):
  File "/tmp/gmvault.bootstrap.1637", line 1, in <module>
    import gmv.gmv_cmd as runner
ImportError: No module named gmv.gmv_cmd

I noticed Python 2.6 and 2.7 installed:

> dpkg --get-selections | grep python
libpython2.6                    install
python                      install
python-apt                  install
python-central                  install
python-gnupginterface               install
python-minimal                  install
python-pkg-resources                install
python-pycurl                   install
python-setuptools               install
python-software-properties          install
python-support                  install
python2.6                   install
python2.6-minimal               install
python2.7                   install
python2.7-minimal               install

So I uninstalled python2.7 and python2.7-minimal and now I get

> gmvault sync foo.bar@gmail.com
Odd. Use default python2.7.x distribution
Error: Cannot find the python executable to set env var PYTHON_BIN.
Please check where your python binary is.

Even if I set PYTHON_BIN it doesn't work:

> which python
/usr/bin/python

> export PYTHON_BIN=/usr/bin/python

> echo $PYTHON_BIN
/usr/bin/python

> gmvault sync foo.bar@gmail.com
Odd. Use default python2.7.x distribution
Error: Cannot find the python executable to set env var PYTHON_BIN.
Please check where your python binary is.

I might have messed it up and it might now be directly related to Gmvault but I would appreciate any ideas how I could solve this...
Thanks!

@gaubert
Copy link
Owner

gaubert commented May 25, 2012

@manuelmeurer How did you install Gmvault (binary distribution or src distribution). What is the plateform ? It looks to be linux but I would like to be sure. I would also need to know which version of Gmvault you have installed.

Many thanks.

@manuelmeurer
Copy link
Author

I first installed pip via curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python and then gmvault via sudo pip install gmvault. And yes, I'm on Ubuntu (10.04).

@gaubert
Copy link
Owner

gaubert commented May 25, 2012

So it is version 1.5-beta of Gmvault ? I have fixed some deployment issue for the src distribution.
I will prepare a new version for you to test (probably on monday). Would it be ok for you to test it ?

thanks

@manuelmeurer
Copy link
Author

Sorry, yes, it's 1.5-beta. I'd be happy to test a new version! Thanks for your effort!

@ghost ghost assigned gaubert May 26, 2012
@Brian-Gaffney
Copy link

I'm also getting this issue (installed from source, Debian 6.0.5).

I'd also be happy to test a new version when it's ready.

Thanks.

@manuelmeurer
Copy link
Author

Does it make sense to test 1.6-beta or wait for 1.7-beta? (this issue is labelled 1.7-beta)

@gaubert
Copy link
Owner

gaubert commented Jun 11, 2012

@manuelmeurer Normally it has not been solved in 1.6-beta. I don't get the problem. It is probably because the python libs are in strange places in ubuntu.
In order to help you, could you run gmvault with sh -x :
$>sh -x gmvault
and send me the print screen.
Could you also let me know when are the python libraries (path to them) and send me the result of the following commands:
$>python
Python 2.7 (r27:82500, Aug 2 2010, 12:39:00)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import gmv.gmv_cmd
print gmv.gmv_cmd.file
Do the same for imaplib
import imaplib
print imaplib.file

Thanks.

@gaubert
Copy link
Owner

gaubert commented Jun 13, 2012

@manuelmeurer as you have 2 python versions 2.6 and 2.7 probably Gmvault has been installed in one of them and the gmvault bash script calls it with the other python interpreter.
Send me the logs from sh -x ./gmvault to see which python is used.

In the mean time you could install virtualenv (pip install virtualenv), create a sandboxed python and install gmvault with the pip in your sandboxed bin dir (cd myvirtualenv/bin; ./pip install gmvault).

Still I would like the install to work on ubuntu so I would appreciate if you can send me the printout of the sh -x ./gmvault command.

Many thanks.

@manuelmeurer
Copy link
Author

Here's the output:

> sh -x gmvault 
+ umask 002
++ unset CDPATH
+++ dirname gmvault
++ cd .
++ pwd
+ HERE=/home/rails
++ unset CDPATH
++ cd /home/rails/..
++ pwd
+ GMVAULT_HOME=/home
+ '[' -f /home/lib/python-lib/bin/python ']'
+ '[' -f /home/bin/python ']'
++ which python2.7
+ PYTHON_BIN=
+ echo 'Odd. Use default python2.7.x distribution'
Odd. Use default python2.7.x distribution
+ '[' '!' ']'
+ echo 'Error: Cannot find the python executable to set env var PYTHON_BIN.'
Error: Cannot find the python executable to set env var PYTHON_BIN.
+ echo 'Please check where your python binary is.'
Please check where your python binary is.
+ exit 1

Neither /home/lib/python-lib nor /home/bin/python exist.

In #52 you mentioned that Gmvault looks for Python 2.7 by default, not 2.6.
Since I uninstalled Python 2.7 after installing Gmvault that is probably why it cannot be found anymore.

I reinstalled Python 2.7 (sudo apt-get install python2.7) and now the output is:

> sh -x gmvault 
+ umask 002
++ unset CDPATH
+++ dirname gmvault
++ cd .
++ pwd
+ HERE=/home/rails
++ unset CDPATH
++ cd /home/rails/..
++ pwd
+ GMVAULT_HOME=/home
+ '[' -f /home/lib/python-lib/bin/python ']'
+ '[' -f /home/bin/python ']'
++ which python2.7
+ PYTHON_BIN=/usr/bin/python2.7
+ echo 'Odd. Use default python2.7.x distribution'
Odd. Use default python2.7.x distribution
+ '[' '!' /usr/bin/python2.7 ']'
+ '[' '!' -f /usr/bin/python2.7 ']'
+ ARGS=
+ cat
+ /usr/bin/python2.7 /tmp/gmvault.bootstrap.30024
Traceback (most recent call last):
  File "/tmp/gmvault.bootstrap.30024", line 1, in <module>
    import gmv.gmv_cmd as runner
ImportError: No module named gmv.gmv_cmd
+ res=1
+ rm -f /tmp/gmvault.bootstrap.30024
+ exit 1

> python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmv.gmv_cmd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/gmv/gmv_cmd.py", line 24, in <module>
    import argparse
ImportError: No module named argparse

After installing argparse (sudo pip install argparse):

> python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmv.gmv_cmd
>>> print gmv.gmv_cmd.__file__
/usr/local/lib/python2.6/dist-packages/gmv/gmv_cmd.pyc
>>> import imaplib
>>> print imaplib.__file__
/usr/lib/python2.6/imaplib.pyc

> gmvault
Odd. Use default python2.7.x distribution
Traceback (most recent call last):
  File "/tmp/gmvault.bootstrap.30194", line 1, in <module>
    import gmv.gmv_cmd as runner
ImportError: No module named gmv.gmv_cmd

I don't have much experience with Python, so unfortunately I can't be of much help troubleshooting this.
Let me know if I can do anything else to help find the issue.

Thanks for your help with this!

@gaubert
Copy link
Owner

gaubert commented Jun 15, 2012

@manuelmeurer Thanks for all the information. I have installed gmvault from pypi on ubuntu 12.04 on the default python distribution and it was working perfectly so I think that it is due to your environment.
I looked at your experiments and in your first attempt, the shell script gmvault cannot find a python 2.6 and fails.
As said in another issue the script was only looking for python 2.7. It has been fixed and will be in the next version.
In the mean time, you could fix the gmvault script by copying the content of which is in the develop branch https://github.com/gaubert/gmvault/blob/develop/etc/scripts/gmvault.

Now looking at your next experiments with a freshly installed python2.7. pip install gmvault installed gmvault to work with the default python distribution (the 2.6.5) and you try to run it with python2.7 which doesn't know about it.

So I would uninstall python2.7 and modify the script to support python2.6.
insert these lines instead of the existing one as done on the gmvault develop version

#look for python2.7 first otherwise try python2.6
PYTHON_BIN=which python2.7 2>/dev/null
if [ ! $PYTHON_BIN ]; then
PYTHON_BIN=which python2.6 2>/dev/null
fi

It seems also that there is something missing as 2.7 includes by default argparse but not 2.6. I will modify the setup.py to have it working properly for 2.6 and 2.7 in the next version.
Thanks for helping me spotting that issue.

Let me know if that solve the issue for you and I will close it.

@manuelmeurer
Copy link
Author

Brilliant, uninstalling 2.7 and using the new script did it!
Thanks a lot!

@gaubert
Copy link
Owner

gaubert commented Jun 15, 2012

Great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants