autojump icon indicating copy to clipboard operation
autojump copied to clipboard

ImportError: No module named autojump_argparse

Open rsparkyc opened this issue 9 years ago • 16 comments

After upgrading to El Capitan and following the instructions to upgrade my macports installation, autojump no longer works. I get the following error when trying to do anything:

$ j phone
Traceback (most recent call last):
  File "/opt/local/bin/autojump", line 41, in <module>
    from autojump_argparse import ArgumentParser
ImportError: No module named autojump_argparse
autojump: directory 'phone' not found
Try `autojump --help` for more information.

rsparkyc avatar Oct 19 '15 14:10 rsparkyc

I had the same issue. Following the instructions for a manual install works perfectly so I would guess this is a problem with the macports package.

campbellC avatar Oct 29 '15 13:10 campbellC

See macports ticket #49212

jpenney avatar Nov 03 '15 12:11 jpenney

it also happens when working with virtualenvs...

I had to hook my zsh to disable autojump when in a virtualenv to avoid this message...

gled-rs avatar Nov 10 '15 19:11 gled-rs

I'm using virtualenvs on Manjaro KDE and this recently happens to me. Edit the first line of the file /usr/bin/autojump to point to the correct interpreter for which autojump_argparse is installed "#!/usr/bin/python3" --> "#!/usr/bin/env python"

greatluke avatar Dec 04 '20 17:12 greatluke

I'm using virtualenvs on Manjaro KDE and this recently happens to me. Edit the first line of the file /usr/bin/autojump to point to the correct interpreter for which autojump_argparse is installed "#!/usr/bin/python3" --> "#!/usr/bin/env python"

I'm using pyenv on Arch and unfortunately your solution didn't work for me.

tigerjack avatar Dec 10 '20 10:12 tigerjack

I'm using virtualenvs on Manjaro KDE and this recently happens to me. Edit the first line of the file /usr/bin/autojump to point to the correct interpreter for which autojump_argparse is installed "#!/usr/bin/python3" --> "#!/usr/bin/env python"

I'm using pyenv on Arch and unfortunately your solution didn't work for me.

Can you tell me:

  1. Directory of the file autojump_argparse.py?
  2. Ouput of "echo $PATH"?

greatluke avatar Dec 10 '20 20:12 greatluke

I'm using virtualenvs on Manjaro KDE and this recently happens to me. Edit the first line of the file /usr/bin/autojump to point to the correct interpreter for which autojump_argparse is installed "#!/usr/bin/python3" --> "#!/usr/bin/env python"

I'm using pyenv on Arch and unfortunately your solution didn't work for me.

Can you tell me:

1. Directory of the file autojump_argparse.py?

2. Ouput of "echo $PATH"?

Hey @greatluke, I ended up removing the package. But I correctly remember that the file was under /usr/lib/python3.9/site-packages, while all the other python packages were under the 3.9 directory (i.e. the freshly updated python version). I don't know autojump didn't get updated.

EDIT: I've just noticed that I made a typo for the directory name; it was /usr/lib/python3.8/site-packages for autojump.

tigerjack avatar Dec 11 '20 11:12 tigerjack

I'm using virtualenvs on Manjaro KDE and this recently happens to me. Edit the first line of the file /usr/bin/autojump to point to the correct interpreter for which autojump_argparse is installed "#!/usr/bin/python3" --> "#!/usr/bin/env python"

I'm using pyenv on Arch and unfortunately your solution didn't work for me.

Can you tell me:

1. Directory of the file autojump_argparse.py?

2. Ouput of "echo $PATH"?

Hey @greatluke, I ended up removing the package. But I correctly remember that the file was under /usr/lib/python3.9/site-packages, while all the other python packages were under the 3.9 directory (i.e. the freshly updated python version). I don't know autojump didn't get updated.

Actually the easiest solution is to move 4 .py files: autojump_argparse, autojump_data, autojump_match, autojump_utils to the directory of the python version that you are using.

greatluke avatar Dec 11 '20 14:12 greatluke

FWIW, I'm running Manjaro Xfce and my autojump broke when I did a system update (which included getting Python 3.9).

I solved it as so: pacman -Rns autojump

Then I rebuilt/installed autojump from the AUR (git clone ... cd ... makepkg -si) (I got autojump from the AUR in the first place).

Not sure if if mattered, but I also made the change "#!/usr/bin/python3" --> "#!/usr/bin/env python" in /usr/bin/autojump.

Now it's working again.

mrever avatar Dec 30 '20 23:12 mrever

FWIW, I'm running Manjaro Xfce and my autojump broke when I did a system update (which included getting Python 3.9).

I solved it as so: pacman -Rns autojump

Then I rebuilt/installed autojump from the AUR (git clone ... cd ... makepkg -si) (I got autojump from the AUR in the first place).

Not sure if if mattered, but I also made the change "#!/usr/bin/python3" --> "#!/usr/bin/env python" in /usr/bin/autojump.

Now it's working again.

I just removed it and reinstalled it via AUR and it works for me. I didn't change anything else.

xtreemrage avatar Dec 31 '20 14:12 xtreemrage

I met a very weird situation about this.

Below is a part of my init_script.

apt install python &&\
	mkdir -p $DIR/tmp &&\
	git clone --depth 1 https://github.com/wting/autojump.git $DIR/tmp/ &&\
	$DIR/tmp/install.py &&\
	rm -rf $DIR/tmp

I tried this with zsh & oh-my-zsh settings. but it fails:

ImportError: No module named autojump_argparse

However, I succeed when I executed install.py from its directory.

apt install python &&\
	mkdir -p $DIR/tmp &&\
	git clone --depth 1 https://github.com/wting/autojump.git $DIR/tmp/ &&\
	cd $DIR/tmp &&\
	$DIR/tmp/install.py &&\
	cd - &&\
	rm -rf $DIR/tmp

Would it be a key to solve this problem?

roeniss avatar May 09 '21 14:05 roeniss

I'm using virtualenvs on Manjaro KDE and this recently happens to me. Edit the first line of the file /usr/bin/autojump to point to the correct interpreter for which autojump_argparse is installed "#!/usr/bin/python3" --> "#!/usr/bin/env python"

For me #!/usr/bin/env python wasn't sufficient I had to change the shebang to the output of which python (which in my case was /usr/bin/pythonso:#!/usr/bin/python` - not ideal but works perfectly both in and outside of a virtualenv

ceuk avatar Nov 26 '21 13:11 ceuk

  1. git clone https://github.com/wting/autojump
  2. python -V
  3. sudo cp autojump/bin/autojump_* /usr/lib/python [your python version] /site-packages/

0x273c42 avatar Dec 14 '21 10:12 0x273c42

In Ubuntu 22.04 I had to make a symbolic link

sudo ln -s /usr/bin/python3 /usr/local/bin/python

isidroas avatar Jun 01 '23 16:06 isidroas

I have a manjaro and it happened after a system update. To solve it:

yay -S autojump

when ask to build select "All" and thats it. autojump is reinstalled and works again

jbagot avatar Jun 27 '23 20:06 jbagot

In case someone still has this issue, autojump-rs, the rust version of autojump does not have this issue.

yay -R autojump yay -S autojump-rs

rivalak avatar Jun 30 '23 16:06 rivalak