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

Homebrew install broken due to using Python 3.8 with outdated jrnl version (v1.9.8) #781

Closed
ghost opened this issue Dec 31, 2019 · 42 comments
Labels
bug Something isn't working 📌 This can't go stale

Comments

@ghost
Copy link

ghost commented Dec 31, 2019

jrnl version 1.9.8
MacOS 10.15.2

AttributeError: module 'time' has no attribute 'clock'

The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or time.process_time() instead, depending on your requirements, to have well-defined behavior. (Contributed by Matthias Bussonnier in bpo-36895.)

https://docs.python.org/3/whatsnew/3.8.html

@ghost ghost added 🆕 New! bug Something isn't working labels Dec 31, 2019
@gloryVine
Copy link

I also get this error.

@yudhvirsinghr
Copy link

I have the same issue, brew installs python@3.8 as dependency for jrnl.

@wren wren removed the 🆕 New! label Jan 4, 2020
@wren
Copy link
Member

wren commented Jan 4, 2020

Ah, yeah. Looks like we need to prioritize #686 to get this dealt with once and for all.

I suspect this is due to brew still installing an old version (v1.9.8) of jrnl.

@insanerwayner
Copy link

I have the same issue in Arch

@wren
Copy link
Member

wren commented Jan 8, 2020

@insanerwayner You need to update to latest jrnl and update Python to 3.6+, and that should resolve your problem.

@wren wren changed the title AttributeError Python 3.8 Homebrew install broken due to using Python 3.8 with outdated jrnl version (v1.9.8) Jan 20, 2020
@wren wren added the 📌 This can't go stale label Jan 20, 2020
@elliotmassen
Copy link

@wren I'm experiencing this issue with the latest jrnl and Python 3.6+. I'm trying to update an encrypted journal, when I close my editor after saving the entry I get the following:

elliots-air:~ elliotmassen$ jrnl
Password: 
[Entry added to default journal]
Traceback (most recent call last):
  File "/usr/local/bin/jrnl", line 11, in <module>
    load_entry_point('jrnl==1.9.8', 'console_scripts', 'jrnl')()
  File "/usr/local/Cellar/jrnl/1.9.8_2/libexec/lib/python3.8/site-packages/jrnl/cli.py", line 227, in run
    journal.write()
  File "/usr/local/Cellar/jrnl/1.9.8_2/libexec/lib/python3.8/site-packages/jrnl/Journal.py", line 181, in write
    journal = self._encrypt(journal)
  File "/usr/local/Cellar/jrnl/1.9.8_2/libexec/lib/python3.8/site-packages/jrnl/Journal.py", line 76, in _encrypt
    iv = Random.new().read(AES.block_size)
  File "/usr/local/Cellar/jrnl/1.9.8_2/libexec/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read
    return self._singleton.read(bytes)
  File "/usr/local/Cellar/jrnl/1.9.8_2/libexec/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 178, in read
    return _UserFriendlyRNG.read(self, bytes)
  File "/usr/local/Cellar/jrnl/1.9.8_2/libexec/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 129, in read
    self._ec.collect()
  File "/usr/local/Cellar/jrnl/1.9.8_2/libexec/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 77, in collect
    t = time.clock()
AttributeError: module 'time' has no attribute 'clock'

When I run brew info python jrnl I get:

elliots-air:~ elliotmassen$ brew info python jrnl
python: stable 3.7.6 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python/3.7.6_1 (4,016 files, 61.8MB) *
  Poured from bottle on 2020-01-16 at 19:20:58
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb
==> Dependencies
Build: pkg-config ✔
Required: gdbm ✔, openssl@1.1 ✔, readline ✔, sqlite ✔, xz ✔
==> Options
--HEAD
        Install HEAD version
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
  brew install python@2

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

jrnl: stable 1.9.8 (bottled)
Command-line note taker
https://jrnl.sh/
/usr/local/Cellar/jrnl/1.9.8_2 (1,820 files, 12MB) *
  Poured from bottle on 2020-01-16 at 19:24:42
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/jrnl.rb
==> Dependencies
Required: python@3.8 ✔

@JoshuaCrewe
Copy link

@elliotmassen I think the problem is that the version that Homebrew supplies is not actually the latest version of jrnl there is. I had this error and removed the brew version and installed from pip. Now I get :

$ jrnl --version
jrnl version 2.1.1

The version in Homebrew is 1.9.8 which is essentially the problem here. If you wanted to continue writing to your journal you can brew remove jrnl then pip3 install jrnl. If going down this route you can't go back. The newer 2.1.1 version will give a little warning that your journal will not be backwards compatible.

The longer term fix would be for the Homebrew formula to get updated to install 2.x version. I imagine this is not so easy or it would have been done already. Happy to help in any way I can though.

@elliotmassen
Copy link

elliotmassen commented Jan 31, 2020

@JoshuaCrewe I'd rather stick with brew if possible. Looking at Homebrew/homebrew-core#45742, it looks like the latest update was rejected as the dependencies weren't updated in the formula. I'd be keen to get this resolved (as I'm unsure of the progress with #686) - I'll look at creating an updated formula tomorrow unless there's a specific reason not to, or if someone else is better suited to (I don't have any prior experience with the jrnl codebase, just a keen user).

@wren
Copy link
Member

wren commented Feb 1, 2020

@elliotmassen Yes, please! The brew formula is definitely outdated, and we just haven't had the time to prioritize it.

To be completely honest, I haven't worked with homebrew before, and don't really know the best way to generate the formula. If you have some knowledge, I would personally appreciate it greatly.

If you're going to update it, could you please update it to v2.2? It's currently in beta, but I'm planning on promoting it to a proper release tomorrow since all the bugs seem to be resolved.

@wren
Copy link
Member

wren commented Feb 1, 2020

@elliotmassen Also, I'll be working on jrnl tomorrow for most of the day, so feel free to reach out if you have any questions or need any help. Just comment here, or message me on twitter (nowandwren)

@elliotmassen
Copy link

@wren I've been looking into updating the formula this afternoon and it looks like it will need a little adjusting due to an issue with poetry in the brew install process. I'm looking at adjusting the formula's install method at the moment to try and get round this.

The long and short of it seems to be that when brew install attempts to run pip install -v --no-deps --no-binary :all: --ignore-installed [PATH], poetry isn't available due to the --no-binary option. It looks to be similar to pypa/pip#6222. I'll keep you updated on the progress.

@wren
Copy link
Member

wren commented Feb 1, 2020

@elliotmassen That makes sense for using our core repo. Poetry is for development and packaging, but not really intended to be distributed with the final product. We have some releases on pypi that should be fully packaged for distribution, and don't have poetry included. Would it be easier to use one of those instead of the github repo?

@elliotmassen
Copy link

@wren Ah good shout! I'm only having success with 2.0.1 at the moment, the other more recent pypi releases seem to have this poetry issue. Perhaps there was some difference in how those releases were built?

@wren
Copy link
Member

wren commented Feb 1, 2020

@elliotmassen I think @micahellison and I had a breakthrough on the Poetry issue. It's related to the pyproject.toml that is packaged with jrnl. Apparently, pip will try to use poetry as a build system with our current config. Currently looking into how we can remove that part of the config while not breaking the rest of our pipeline.

@wren
Copy link
Member

wren commented Feb 1, 2020

@elliotmassen Hey, I think I have a fix. I'm making a PR shortly. Do you mind if I add you as a co-author, since your research into the poetry problem was what unblocked this ticket?

wren added a commit to wren/jrnl that referenced this issue Feb 1, 2020
We don't use it, and it breaks the homebrew install.
@elliotmassen
Copy link

@wren Sure, go for it!

@phil-isaacs
Copy link

I'm confused. Is the recommended approach now just to use the pip version of jrnl or will there be fix for the brew formula at some point soon.

@JoshuaCrewe
Copy link

@phil-isaacs if you want to use jrnl right now then install it with pip, the home brew version is currently too old.

I believe that there is an effort to get the home brew formula up to date and then automated. The reason it has not been done yet it time available. @elliotmassen and @wren are figuring out how to handle the dependencies during the build of jrnl.

Do correct me if I am wrong though.

@phil-isaacs
Copy link

If I install the pip version will I be able to go back the brew version once it has been fixed?

@JoshuaCrewe
Copy link

JoshuaCrewe commented Feb 5, 2020

I expect so. Currently pip3 install jrnl will give version 2.1.1 . The intention is to brew install version 2.2. By which time pip will also install that same version. Same binary just built with different package managers.

What you won’t be able to do it go from jrnl 2.1 back to 1.9.8 which is what brew currently does. If you pip install now and use version 2.x you won’t be able to use the brew version until this is resolved.

Once hombrew is installing version 2.2 you could uninstall with pip and switch to homebrew fine as I understand it.

Edit: writing on my phone which is causing my typing accuracy problems and autocorrect getting involved.

@phil-isaacs
Copy link

Okay, that's perfect. Thanks so much

@elliotmassen
Copy link

I've opened a PR on my fork for us to have a look at, it contains an updated formula (and some other commits that I'll look at cleaning up later). https://github.com/elliotmassen/homebrew-core/pull/1 cc: @wren.

@wren
Copy link
Member

wren commented Feb 6, 2020

Awesome! I'll take a look tonight. Thank you!

@wren
Copy link
Member

wren commented Feb 7, 2020

@elliotmassen Thanks, again for your work on this. It's looking great!

Other than the test, the formula works for me. Can you try it with this package instead of the one from pypi?

  url "https://github.com/jrnl-org/jrnl/releases/download/v2.2/jrnl-2.2-brew.tar.gz"
  sha256 "335c1629b5ae8bc1b8812d4f3ad5d188e4b2342842c9d033388c97f7049bec3a"

I think I can consistently generate the above package as part of the regular deployment process, so it might be easier if we go that route. If nothing else, we can do the above with v2.2 and don't have to release v2.2.1 just yet.

What do you think?

@wren
Copy link
Member

wren commented Feb 8, 2020

I set up a test on what is likely our future prerelease channel. If any of you could give this a shot, I would really appreciate it. This will install jrnl v2.2 for you. It's the actualy v2.2 release (not the beta), but it's labeled beta here because the brew install of the v2 branch is pretty untested right now. Please let us know if this does or does not work for you.

brew tap jrnl-org/prerelease
brew install jrnl-beta

cc: @elliotmassen @phil-isaacs @JoshuaCrewe

@wren
Copy link
Member

wren commented Feb 8, 2020

Also, you may want to pip uninstall jrnl and any other version you might have.

@elliotmassen
Copy link

@wren That seems to work fine for me!

@JoshuaCrewe
Copy link

@wren works for me too. Uninstalled pip version and installed the Homebrew version via the tap. No issues reading or writing to the journal version 2.2.

💯

@billdiego
Copy link

@JoshuaCrewe @wren I admit to being a bit confused. Issuing a brew info jrnl command still shows version 1.9.8 as the most recent version for me.. How can I access version 2.2? Thanks.

@elliotmassen
Copy link

@billdiego Last I heard @wren mentioned that they wanted to wait for further testing before submitting the new brew formula.

@billdiego
Copy link

@elliotmassen Thank you!

@wren
Copy link
Member

wren commented Feb 14, 2020

@JoshuaCrewe @wren I admit to being a bit confused. Issuing a brew info jrnl command still shows version 1.9.8 as the most recent version for me.. How can I access version 2.2? Thanks.

If you'd like to help us test, you can install with the below. And please let us know if you see any problems.

brew tap jrnl-org/prerelease
brew install jrnl-beta

@wren
Copy link
Member

wren commented Feb 15, 2020

@elliotmassen I think it's good to submit the new brew formula. Although I'd prefer to do more testing, I think a lot of people are waiting on the update, so it's best to get it out. Even if it has any problems, the current formula is completely broken. So I will take "not completely tested but probably not broken" over "definitely broken" any day.

Let me know if you have any questions or need any help getting that through. Thanks, again!

@elliotmassen
Copy link

@wren Brilliant, I'll take a look at that tomorrow morning and will be sure to get in touch if need be. I'll cc you in the submission so that you can keep track of progress too.

@billdiego
Copy link

billdiego commented Feb 17, 2020

@JoshuaCrewe @wren I admit to being a bit confused. Issuing a brew info jrnl command still shows version 1.9.8 as the most recent version for me.. How can I access version 2.2? Thanks.

If you'd like to help us test, you can install with the below. And please let us know if you see any problems.

brew tap jrnl-org/prerelease
brew install jrnl-beta

@wren I realize that you are considering releasing v2.2 as production, but I did want to help test out via the prelease tap. However, attempting to follow your instructions leaves me with an error:

bdmbp:~ bdiego> brew tap "jrnl-org/prelease"
==> Tapping jrnl-org/prelease
Cloning into '/usr/local/Homebrew/Library/Taps/jrnl-org/homebrew-prelease'...
Username for 'https://github.com': billdiego
Password for 'https://billdiego@github.com':
remote: Repository not found.
fatal: repository 'https://github.com/jrnl-org/homebrew-prelease/' not found
Error: Failure while executing; git clone https://github.com/jrnl-org/homebrew-prelease /usr/local/Homebrew/Library/Taps/jrnl-org/homebrew-prelease --depth=1 exited with 128.

Not sure how to prevent the 'homebrew-' string from being automatically inserted before the 'prerelease' string....

@wren
Copy link
Member

wren commented Feb 21, 2020

@billdiego I have to admit that I've never seen that. FYI, the "homebrew-" is a normal part of homebrew taps, and brew will automatically add/remove it as necessary to process the commands.

Can you give us some more info about your system? Also, please run brew doctor and see if you have any problems there.

@billdiego
Copy link

@billdiego I have to admit that I've never seen that. FYI, the "homebrew-" is a normal part of homebrew taps, and brew will automatically add/remove it as necessary to process the commands.

Can you give us some more info about your system? Also, please run brew doctor and see if you have any problems there.

@wren I read the Homebrew docs repeatedly and it's still a bit confusing; it implies that if one uses the longer 2-argument version of the tap command, the URI can be anything you want; however, if the tap is hosted on github, the repo must use "homebrew-" in the name to be found: https://docs.brew.sh/Taps (see first bullet second section). So yea, still scratching my head.

As to my system, it's a mid-2015 Retina MBP 2.8GHz/i7 16GB RAM, still on Mojave, using 10.14.6; brew doctor returns that I'm ready to brew. I have a number of other Homebrew utilities that I use; no issues.

@wren
Copy link
Member

wren commented Feb 22, 2020

Oh, ha. I just noticed the problem in your original command. You seem to have misspelled "prerelease" while tapping.

bdmbp:~ bdiego> brew tap "jrnl-org/prelease"

@billdiego
Copy link

@wren Oh wow. That was indeed the problem. Great catch and my apologies for wasting your time with my careless error. Guess it's time to give up that 5th grade spelling bee trophy...

@wren
Copy link
Member

wren commented Feb 24, 2020

@billdiego Haha, no worries. Thanks for reporting in regardless! And please let us know if you see any problems with the brew formula.

@wren
Copy link
Member

wren commented Feb 27, 2020

For anyone following this thread, we have a PR open with homebrew-core that's currently going through code review. It'll hopefully get through soon, but you can follow along at Homebrew/homebrew-core#50593 if you're curious.

@wren
Copy link
Member

wren commented Mar 7, 2020

🎉 brew install jrnl now installs v2.2! 🎉

@wren wren closed this as completed Mar 7, 2020
wren added a commit that referenced this issue Apr 18, 2020
We don't use it, and it breaks the homebrew install.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📌 This can't go stale
Projects
None yet
Development

No branches or pull requests

8 participants