ivandokov / phockup

Media sorting tool to organize photos and videos from your camera in folders by year, month and day.
MIT License
856 stars 108 forks source link

MacOS homebrew install throws "ModuleNotFoundError: No module named 'tqdm'" #227

Open wtangofoxtrot opened 10 months ago

wtangofoxtrot commented 10 months ago

This appears to have been solved already in https://github.com/ivandokov/phockup/issues/170 ?

Macbock pro m2 running 13.6.3

% brew install phockup
phockup 1.12.0 is already installed but outdated (so it will be upgraded).
==> Fetching ivandokov/contrib/phockup
==> Downloading https://files.pythonhosted.org/packages/62/06/d5604a70d160f6a6ca5fd2ba25597c24abd5c5ca5f437263d177ac242308/tqdm-4.66.1.tar.gz
Already downloaded: /Users/wtangofoxtrot/Library/Caches/Homebrew/downloads/2e64e0824967f2e1dfb0465e339bc6741b791491c14679cbb6922e4622d649ea--tqdm-4.66.1.tar.gz
==> Downloading https://github.com/ivandokov/phockup/archive/1.13.0.tar.gz
==> Downloading from https://codeload.github.com/ivandokov/phockup/tar.gz/refs/tags/1.13.0
##O=- #     #
==> Upgrading ivandokov/contrib/phockup
  1.12.0 -> 1.13.0

==> /opt/homebrew/opt/python@3.11/bin/python3 -m venv --system-site-packages --without-pip /opt/homebrew/Cellar/phockup/1.13.0/libexec
==> /opt/homebrew/opt/python@3.11/bin/python3 -m pip --python=/opt/homebrew/Cellar/phockup/1.13.0/libexec/bin/python install /private/tmp/phockup--tqdm-20231228-62065-37iett/tqdm-4.66.1
🍺  /opt/homebrew/Cellar/phockup/1.13.0: 87 files, 331.5KB, built in 6 seconds
==> Running `brew cleanup phockup`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /opt/homebrew/Cellar/phockup/1.12.0... (91 files, 358.3KB)
Removing: /Users/wtangofoxtrot/Library/Caches/Homebrew/phockup--1.12.0.tar.gz... (25.6KB)

when i run it however i get:

% phockup
Traceback (most recent call last):
  File "/opt/homebrew/bin/phockup", line 11, in <module>
    from src.phockup import Phockup
  File "/opt/homebrew/Cellar/phockup/1.13.0/src/phockup.py", line 11, in <module>
    from tqdm import tqdm
ModuleNotFoundError: No module named 'tqdm'

however installing tqdm via pip did not solve the issue:

% pip3 install tqdm
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: tqdm in /Users/wtangofoxtrot/Library/Python/3.9/lib/python/site-packages (4.66.1)

This is because homebrew is using a different python install:

% where python3
/opt/homebrew/bin/python3
/usr/bin/python3

i was able to fix the issue by updating that version of tqdm manually:

% /opt/homebrew/bin/python3 -m pip install tqdm
Collecting tqdm
  Downloading tqdm-4.66.1-py3-none-any.whl.metadata (57 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.6/57.6 kB 1.7 MB/s eta 0:00:00
Downloading tqdm-4.66.1-py3-none-any.whl (78 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.3/78.3 kB 5.2 MB/s eta 0:00:00
Installing collected packages: tqdm
Successfully installed tqdm-4.66.1

[notice] A new release of pip is available: 23.3.1 -> 23.3.2
[notice] To update, run: python3.11 -m pip install --upgrade pip

it now works without the missing module:

% phockup
usage: phockup [-h] [-v] [-d DATE] [-m | -l] [-o] [-t] [-y] [-c 1-255] [--maxdepth 1-255] [-r REGEX] [-f DATE_FIELD] [--debug | --quiet | --progress] [--log LOG] [--file-type image|video]
               [--no-date-dir NO_DATE_DIR] [--skip-unknown] [--movedel] [--rmdirs] [--output_prefix OUTPUT_PREFIX] [--output_suffix OUTPUT_SUFFIX] [--from-date FROM_DATE] [--to-date TO_DATE]
               INPUTDIR OUTPUTDIR
phockup: error: the following arguments are required: INPUTDIR, OUTPUTDIR

Is this something that needs to be fixed in homebrew ?

ivandokov commented 10 months ago

Hello,

I am not sure what's the issue but I believe you had to only reinstall phockup. You shouldn't have installed the missing module manually.

Kind regards, Ivan Dokov

CEO | JetSpark jetspark.io

This email, including the attachments, is private and confidential. It should not be read, copied, disclosed or otherwise used by any person other than the intended recipient(s). If you have received this email in error, please notify the sender immediately.

On Thu, 28 Dec 2023 at 23:04, wtangofoxtrot @.***> wrote:

This appears to have been solved already in #170 https://github.com/ivandokov/phockup/issues/170 ?

Macbock pro m2 running 13.6.3

% brew install phockup phockup 1.12.0 is already installed but outdated (so it will be upgraded). ==> Fetching ivandokov/contrib/phockup ==> Downloading https://files.pythonhosted.org/packages/62/06/d5604a70d160f6a6ca5fd2ba25597c24abd5c5ca5f437263d177ac242308/tqdm-4.66.1.tar.gz Already downloaded: /Users/wtangofoxtrot/Library/Caches/Homebrew/downloads/2e64e0824967f2e1dfb0465e339bc6741b791491c14679cbb6922e4622d649ea--tqdm-4.66.1.tar.gz ==> Downloading https://github.com/ivandokov/phockup/archive/1.13.0.tar.gz ==> Downloading from https://codeload.github.com/ivandokov/phockup/tar.gz/refs/tags/1.13.0

O=- https://codeload.github.com/ivandokov/phockup/tar.gz/refs/tags/1.13.0#%23O=-

==> Upgrading ivandokov/contrib/phockup 1.12.0 -> 1.13.0

==> @./bin/python3 -m venv --system-site-packages --without-pip /opt/homebrew/Cellar/phockup/1.13.0/libexec ==> @./bin/python3 -m pip --python=/opt/homebrew/Cellar/phockup/1.13.0/libexec/bin/python install /private/tmp/phockup--tqdm-20231228-62065-37iett/tqdm-4.66.1 🍺 /opt/homebrew/Cellar/phockup/1.13.0: 87 files, 331.5KB, built in 6 seconds ==> Running brew cleanup phockup... Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew). Removing: /opt/homebrew/Cellar/phockup/1.12.0... (91 files, 358.3KB) Removing: /Users/wtangofoxtrot/Library/Caches/Homebrew/phockup--1.12.0.tar.gz... (25.6KB)

when i run it however i get:

% phockup Traceback (most recent call last): File "/opt/homebrew/bin/phockup", line 11, in from src.phockup import Phockup File "/opt/homebrew/Cellar/phockup/1.13.0/src/phockup.py", line 11, in from tqdm import tqdm ModuleNotFoundError: No module named 'tqdm'

however installing tqdm via pip did not solve the issue:

% pip3 install tqdm Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: tqdm in /Users/wtangofoxtrot/Library/Python/3.9/lib/python/site-packages (4.66.1)

This is because homebrew is using a different python install:

% where python3 /opt/homebrew/bin/python3 /usr/bin/python3

i was able to fix the issue by updating that version of tqdm manually:

% /opt/homebrew/bin/python3 -m pip install tqdm Collecting tqdm Downloading tqdm-4.66.1-py3-none-any.whl.metadata (57 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.6/57.6 kB 1.7 MB/s eta 0:00:00 Downloading tqdm-4.66.1-py3-none-any.whl (78 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.3/78.3 kB 5.2 MB/s eta 0:00:00 Installing collected packages: tqdm Successfully installed tqdm-4.66.1

[notice] A new release of pip is available: 23.3.1 -> 23.3.2 [notice] To update, run: python3.11 -m pip install --upgrade pip

it now works without the missing module:

% phockup usage: phockup [-h] [-v] [-d DATE] [-m | -l] [-o] [-t] [-y] [-c 1-255] [--maxdepth 1-255] [-r REGEX] [-f DATE_FIELD] [--debug | --quiet | --progress] [--log LOG] [--file-type image|video] [--no-date-dir NO_DATE_DIR] [--skip-unknown] [--movedel] [--rmdirs] [--output_prefix OUTPUT_PREFIX] [--output_suffix OUTPUT_SUFFIX] [--from-date FROM_DATE] [--to-date TO_DATE] INPUTDIR OUTPUTDIR phockup: error: the following arguments are required: INPUTDIR, OUTPUTDIR

Is this something that needs to be fixed in homebrew ?

β€” Reply to this email directly, view it on GitHub https://github.com/ivandokov/phockup/issues/227, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR7RT2F4GPS3HHQM6C434LYLXNHXAVCNFSM6AAAAABBF4XJAGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TQOBRHE4DCOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

wtangofoxtrot commented 10 months ago

Hey @ivandokov I did try re-installing a few times via homebrew but still ran into the issue with the missing tqdm module.

ivandokov commented 10 months ago

Have you updated homebrew's formulas repository as the fix is inside the formula, not in the software.

JamesABaker commented 10 months ago

I have the same issue as another user https://github.com/ivandokov/phockup/issues/170#issuecomment-1304537112.

The snap package seems to have the same missing module.

$ snap install phockup
phockup 1.7.1 from Ivan Dokov (dokov) installed
$ phockup --help
Traceback (most recent call last):
  File "/snap/phockup/407/phockup.py", line 11, in <module>
    from src.phockup import Phockup
  File "/snap/phockup/407/src/phockup.py", line 9, in <module>
    from tqdm import tqdm
ModuleNotFoundError: No module named 'tqdm'
$ pip list | grep tqdm
tqdm                               4.50.2

Would you like me to open a separate issue relating to the snap package to keep this issue related only to the homebrew package?

ivandokov commented 10 months ago

@JamesABaker did you updated the formula before (re)installing?

The snap package is pretty outdated https://github.com/ivandokov/phockup/issues/153

JamesABaker commented 9 months ago

Works from brew! It sounds like the snap is just out of date.

maxexcloo commented 9 months ago

Had the same problem on a fresh install just now, using the guide in the readme...

ivandokov commented 9 months ago

@maxexcloo did you have the tap installed just before brew install phockup or you had it previously installed (using older version of the formula).

maxexcloo commented 9 months ago

No, completely new install, I added the tap and then installed the cask from the tap as mentioned in the readme…

jasonish commented 8 months ago

Same here. Just install Brew now, added the tap, install phockup and:

Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/bin/phockup", line 11, in <module>
    from src.phockup import Phockup
  File "/home/linuxbrew/.linuxbrew/Cellar/phockup/1.13.0/src/phockup.py", line 11, in <module>
    from tqdm import tqdm
ModuleNotFoundError: No module named 'tqdm'

I get the same error using the Snap.

barbich commented 6 months ago

Hi I've been having the same issue for some time also. Worked around it the same way as @wtangofoxtrot did.

But just got a fresh new Mac, with a completely fresh install for brew and therefore phockup. Same error as others:

MBA-seb:~ seb$ phockup
Traceback (most recent call last):
  File "/opt/homebrew/bin/phockup", line 11, in <module>
    from src.phockup import Phockup
  File "/opt/homebrew/Cellar/phockup/1.13.0/src/phockup.py", line 11, in <module>
    from tqdm import tqdm
ModuleNotFoundError: No module named 'tqdm'
MBA-seb:~ seb$

I digged into it a bit more and noticed that as phockup is not installed as a "clean" python app, and therefore the shebang for phockup is "incorrect" :

MBA-seb:~ seb$ head -n +1 /opt/homebrew/bin/phockup
#!/usr/bin/env python3

which should be something like:

/opt/homebrew/Cellar/phockup/1.13.0/libexec/bin/python

In other words,I believe, the brew installation is not using the the venv installation of python and tqdm but is using the system installation which wont contain the resources required ...

javierruizorg commented 4 months ago

Thanks for the above. I am not having luck trying the manual install:


$ /opt/homebrew/bin/python3 -m pip install tqdm

error: externally-managed-environment

Γ— This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.```
wtangofoxtrot commented 4 months ago

Thanks for the above. I am not having luck trying the manual install:

$ /opt/homebrew/bin/python3 -m pip install tqdm

error: externally-managed-environment

Γ— This environment is externally managed
╰─> To install Python packages system-wide, try brew install
   xyz, where xyz is the package you are trying to
   install.```

@javierruizorg Had the same issue recently, I think my mac's python is now being controlled by IT, the workaround is dont modify the local python env by using using a venv. Heres what I think i did:

python3 -m venv python_venv
source python_venv/bin/activate  # this puts you in the venv
python3 -m pip install tdqm # installing in the venv only
phockup ...
StudioLE commented 4 months ago

I'm also seeing this issue after installing via homebrew on Project Bluefin OS

micampe commented 4 days ago

this fixes the formula:

diff --git a/Formula/phockup.rb b/Formula/phockup.rb
index a291a71..d27c75c 100644
--- a/Formula/phockup.rb
+++ b/Formula/phockup.rb
@@ -24,6 +24,10 @@ class Phockup < Formula

     prefix.install Dir["*"]
     bin.install_symlink prefix/"phockup.py" => "phockup"
+
+    inreplace prefix/"phockup.py",
+              "#!/usr/bin/env python3",
+              "#!#{prefix}/libexec/bin/python"
   end

   test do