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

First run of jrnl, getting ModuleNotFoundError #1010

Closed
northern-arizona opened this issue Jul 29, 2020 · 15 comments · Fixed by #1011
Closed

First run of jrnl, getting ModuleNotFoundError #1010

northern-arizona opened this issue Jul 29, 2020 · 15 comments · Fixed by #1011
Labels
needs more info Further information is requested stale Inactive issue: will be closed soon if no activity support End user support

Comments

@northern-arizona
Copy link

northern-arizona commented Jul 29, 2020

Environment

  • Jrnl version: (not sure. jrnl -v produces an error)
  • Install method: pipx
  • OS: Linux, Pop_OS 20.04

What are you trying to do?

I am trying to run jrnl for the first time.

What have you tried?

My system came with Python 2.7.18rc1.
I installed (from source) Python 3.8.5

Even after installing the latest python, I still get the same ModuleNotFoundError

Here is the output of the jrnl command.

$ jrnl
Traceback (most recent call last):
  File "./.local/bin/jrnl", line 5, in <module>
    from jrnl.cli import run
  File "/home/tj/.local/pipx/venvs/jrnl/lib/python3.8/site-packages/jrnl/cli.py", line 24, in <module>
    import packaging.version
ModuleNotFoundError: No module named 'packaging'

So, I then tried:

pipx install packaging

No apps associated with package packaging. If you are attempting to install a library, pipx should not be used. Consider using pip or a similar tool instead.

Not sure what to do. I want to use jrnl, but I think something with Python is not working correctly.

@northern-arizona northern-arizona added 🆕 New! support End user support labels Jul 29, 2020
@wren
Copy link
Member

wren commented Jul 29, 2020

The short version: pipx runpip jrnl install packaging should fix your problem

The long version: looks like one of our dependencies is out of whack. I'm looking into it; stay tuned.

@wren
Copy link
Member

wren commented Jul 29, 2020

So, it looks like one of the packages we recently introduced (packaging), is only listed under our dev dependencies (not under normal dependencies). Our tests didn't catch it because they all have the dev dependencies installed. So, that's a problem in our tests; sorry about that!

So, I'll make a separate issue to fix the hole in our tests, but for now I'll put up a PR soon to patch this more immediate problem. For now, the workaround is running pipx runpip jrnl install packaging after jrnl is installed.

@wren wren added bug Something isn't working and removed 🆕 New! support End user support labels Jul 29, 2020
@northern-arizona
Copy link
Author

northern-arizona commented Jul 29, 2020

Thanks. I am making progress using your suggestions.

pipx runpip jrnl install packaging got rid of the error regarding packaging. Then jrnl then complained about missing "readline". I ran $ pipx runpip jrnl install readline, and now I get this far:

$ jrnl
Path to your journal file (leave blank for /home/tj/.local/share/jrnl/journal.txt): 
double free or corruption (out)
Aborted (core dumped)

What's next to fix this error?

@wren
Copy link
Member

wren commented Jul 29, 2020

I'm not familiar with Pop OS, so please bear with me. Can you walk me through your installation of Python? I ask because normally readline is included in Python distributions, but not on some of them (like Active Python on Windows). Which source did you use? What steps did you take?

@wren
Copy link
Member

wren commented Jul 29, 2020

Reading up a bit on Pop OS, it looks like it ships with Python 3 installed as python3. Can you also include the output from python3 --version please?

@northern-arizona
Copy link
Author

My system (Pop_OS 20.04) came with python as follows:

$ python --version
Python 2.7.18rc1

I didn't know that my system also came with Python 3 (I only thought to try $ python --version and never thought to run $ python3 --version). So, I figured I needed the newest Python, so I downloaded the tgz source file from https://www.python.org/downloads/ and the latest version was 3.8.5. After uncompressing it into its own directory, I changed directory into that directory and ran:

$ ./configure
$ make
$ make test
$ sudo make install

Now, my system has Python 3.8.5

$ python3 --version
Python 3.8.5

@wren
Copy link
Member

wren commented Jul 31, 2020

Ah, okay. Would you mind installing pipx through the system Python (python3), and then jrnl from there. This should tell us if the Python from source is missing some dependencies that the system one isn't.

@wren wren added support End user support and removed bug Something isn't working labels Jul 31, 2020
@northern-arizona
Copy link
Author

Ok. Here's what I did:

Uninstall jrnl:

$ pipx uninstall jrnl
uninstalled jrnl! ✨ 🌟 ✨

Uninstall pipx:

$ python3 -m pip uninstall pipx
Found existing installation: pipx 0.15.4.0
Uninstalling pipx-0.15.4.0:
  Would remove:
    /home/tj/.local/bin/pipx
    /home/tj/.local/lib/python3.8/site-packages/pipx-0.15.4.0.dist-info/*
    /home/tj/.local/lib/python3.8/site-packages/pipx/*
Proceed (y/n)? y
  Successfully uninstalled pipx-0.15.4.0

Install pipx using python3:

$ python3 -m pip install --user pipx
Collecting pipx
  Using cached pipx-0.15.4.0-py3-none-any.whl (39 kB)
Requirement already satisfied: userpath in ./.local/lib/python3.8/site-packages (from pipx) (1.4.1)
Requirement already satisfied: argcomplete<2.0,>=1.9.4 in ./.local/lib/python3.8/site-packages (from pipx) (1.12.0)
Requirement already satisfied: click in ./.local/lib/python3.8/site-packages (from userpath->pipx) (7.1.2)
Requirement already satisfied: distro; platform_system == "Linux" in ./.local/lib/python3.8/site-packages (from userpath->pipx) (1.5.0)
Installing collected packages: pipx
Successfully installed pipx-0.15.4.0

Run the "ensurepath" command for pipx:

$ python3 -m pipx ensurepath
The directory `/home/tj/.local/bin` is already in PATH. If you are sure you want to proceed, try again with the '--force' flag.

Otherwise pipx is ready to go! ✨ 🌟 ✨

Install jrnl using pipx:

$ pipx install jrnl
  installed package jrnl 2.4.5, Python 3.8.5
  These apps are now globally available
    - jrnl
done! ✨ 🌟 ✨

Run jrnl:

$ jrnl
Traceback (most recent call last):
  File "./.local/bin/jrnl", line 5, in <module>
    from jrnl.cli import run
  File "/home/tj/.local/pipx/venvs/jrnl/lib/python3.8/site-packages/jrnl/cli.py", line 31, in <module>
    from . import install, plugins, util
  File "/home/tj/.local/pipx/venvs/jrnl/lib/python3.8/site-packages/jrnl/install.py", line 16, in <module>
    import readline
ModuleNotFoundError: No module named 'readline'

Install readline:

$ pipx runpip jrnl install readline
Processing ./.cache/pip/wheels/f3/4c/c1/897579289bc84dd6547925f38958ade4494352a353397c9d82/readline-6.2.4.1-cp38-cp38-linux_x86_64.whl
Installing collected packages: readline
Successfully installed readline-6.2.4.1

Try jrnl again:

$ jrnl
Path to your journal file (leave blank for /home/tj/.local/share/jrnl/journal.txt): 
double free or corruption (out)
Aborted (core dumped)

Got this error. What's my next step?

@micahellison
Copy link
Member

Hi @northern-arizona, thanks for providing all this detailed info.

We've seen issues like this a couple times before, and it's always boiled down to a problem with readline, which is supposed to be in the Python standard library. The readline module on pypi is deprecated and appears to have some sort of memory allocation issue in newer versions of Python (or newer operating systems, I'm not sure), which I believe leads to this "core dumped" error.

I see you built Python from source - did you encounter an error message regarding readline while doing so? There may be steps you can take to troubleshoot that issue, if so.

Alternatively, I have the understanding that your OS has the apt package manager built in, and you may be able to reinstall Python using apt-get to bypass this readline problem.

@northern-arizona
Copy link
Author

I cannot find a way to remove the Python 3.8.5 which I installed from source. I was hoping to go back to the python3 version which came with my distro, but I'm afraid to break my whole system by botching an uninstall of Python 3.8.5.

If I could roll back to the python3 which came with my distro, I would be able to do apt-get to be sure I have the up-to-date files.

@wren
Copy link
Member

wren commented Aug 6, 2020

Been thinking about this, and it sounds like trying to separate the system python from the one installed from source would cause a lot of headaches. Can you maybe try to install jrnl through homebrew? That packages its own, isolated version of python to run with installed packages. That way you don't have to worry about the various versions of python you already have installed.

@wren wren added the needs more info Further information is requested label Aug 16, 2020
@stale
Copy link

stale bot commented Oct 16, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Inactive issue: will be closed soon if no activity label Oct 16, 2020
@stale stale bot closed this as completed Oct 24, 2020
@stockphrase
Copy link

stockphrase commented Jul 11, 2022

I'm suddenly experiencing this issue.

al@rufus:~$ pipx install jrnl
/home/al/.local/pipx/shared/bin/python: No module named pip
Failed to upgrade shared libraries
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pipx/shared_libs.py", line 113, in upgrade
    subprocess_post_check(upgrade_process)
  File "/usr/lib/python3/dist-packages/pipx/util.py", line 202, in subprocess_post_check
    raise PipxError(
pipx.util.PipxError: '/home/alan/.local/pipx/shared/bin/python -m pip --disable-pip-version-check
install -q --upgrade pip setuptools wheel' failed
'jrnl' already seems to be installed. Not modifying existing installation in
'/home/al/.local/pipx/venvs/jrnl'. Pass '--force' to force installation.
all@rufus:~$ jrnl -v
Traceback (most recent call last):
  File "/home/al/.local/bin/jrnl", line 5, in <module>
    from jrnl.cli import cli
ModuleNotFoundError: No module named 'jrnl' 

@wren
Copy link
Member

wren commented Jul 11, 2022

@stockphrase It looks like something is up with your python installation (pip is missing). Without pip, nothing will really install properly.

Can you reinstall python to see if that fixes your issue? If not, can you please provide some more info about your system and the python installation?

@janskyview
Copy link

I just did pipx install --force jrnl and that fixed my issue, I'm on Kali.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Further information is requested stale Inactive issue: will be closed soon if no activity support End user support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants