lgarron / folderify

:file_folder: Generate pixel-perfect macOS folder icons in the native style.
MIT License
1.56k stars 39 forks source link

"python3: No module named folderify" when attempting to invoke legacy 2.4.2 #83

Closed cdn-content closed 10 months ago

cdn-content commented 10 months ago

I am still on a MacBook running Catalina, and recently updated my homebrew formulae en masse. I probably should have excluded folderify from the update. Anyhow, now I do have the latest version of folderify, but want to revert to using 2.4.2 in order to have OSX-style folders.

I tried following the steps on the homepage, installing legacy folderify through python. It seems to be installed, but throws an error when attempting to run:

Catalinas-MacBook-Pro:~ catalina$ pip3 install folderify
Requirement already satisfied: folderify in /usr/local/lib/python3.11/site-packages (2.4.2)
Catalinas-MacBook-Pro:~ catalina$ python3.11 -m folderify -v --no-trim /Users/catalina/Downloads/Fonts/mask.png /Users/catalina/Downloads/Fonts 
/opt/local/bin/python3.11: No module named folderify
Catalinas-MacBook-Pro:~ catalina$ python3 -m folderify -v --no-trim /Users/catalina/Downloads/Fonts/mask.png /Users/catalina/Downloads/Fonts 
/opt/local/bin/python3: No module named folderify

As a workaround, I tried reinstalling the older version using the steps described in this article, but also get an error.

https://cmichel.io/how-to-install-an-old-package-version-with-brew/

Catalinas-MacBook-Pro:~ catalina$ brew tap-new -v $USER/local-folderify-legacy
git -c init.defaultBranch=main init
Initialized empty Git repository in /usr/local/Homebrew/Library/Taps/catalina/homebrew-local-folderify-legacy/.git/
git add --all
git commit -m Create catalina/local-folderify-legacy tap
[master (root-commit) 77f9aa8] Create catalina/local-folderify-legacy tap
 Committer: XXXXXX XXXXXX <catalina@Catalinas-MacBook-Pro.local>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 3 files changed, 90 insertions(+)
 create mode 100644 .github/workflows/publish.yml
 create mode 100644 .github/workflows/tests.yml
 create mode 100644 README.md
git branch -m main
==> Created catalina/local-folderify-legacy
/usr/local/Homebrew/Library/Taps/catalina/homebrew-local-folderify-legacy

When a pull request making changes to a formula (or formulae) becomes green
(all checks passed), then you can publish the built bottles.
To do so, label your PR as `pr-pull` and the workflow will be triggered.
Catalinas-MacBook-Pro:~ catalina$ brew extract -v --version=2.4.2 folderify $USER/local-folderify-legacy
==> Searching repository history
Error: Could not find folderify! The formula or version may not have existed.
Catalinas-MacBook-Pro:~ catalina$ brew extract -v --version=2.4.2 local-folderify-legacy $USER/local-folderify-legacy
==> Searching repository history
Error: Could not find local-folderify-legacy! The formula or version may not have existed.

The website says to try and "manually checkout the git hash of the tap and install the version" but I don't know where to find that hash and enter it into the code snippet provided.

What if the package can not be found?

For some reason, it can still be the case that brew is unable to find your version:

Error: Could not find <packageName> but homebrew/core is a shallow clone!
Try again after running: ...

In this case, one can manually checkout the git hash of the tap and install the version:


# list all local taps
brew tap

go to tap and check out correct hash

cd /usr/local/Homebrew/Library/Taps/ git checkout

prevent brew from checking out different hash

HOMEBREW_NO_AUTO_UPDATE=1 brew install

can list and switch between all versions

brew list --versions brew switch


I get as far as `git checkout` and hit a wall, because I don't know what hash to put in.

Catalinas-MacBook-Pro:~ catalina$ brew tap -v homebrew-ffmpeg/ffmpeg homebrew/bundle homebrew/cask homebrew/core homebrew/services catalina/local-folderify catalina/local-folderify-legacy Catalinas-MacBook-Pro:~ catalina$ cd /usr/local/Homebrew/Library/Taps/catalina/homebrew-local-folderify-legacy Catalinas-MacBook-Pro:homebrew-local-folderify-legacy catalina$ git checkout


If I could avoid this more convoluted method and install 2.4.2 via python as mentioned in the official instructions, that would be ideal. However, the official method does not seem to be working either, as stated above, even though python seems to indicate that it has been installed.

Catalinas-MacBook-Pro:~ catalina$ pip3 install folderify Requirement already satisfied: folderify in /usr/local/lib/python3.11/site-packages (2.4.2) Catalinas-MacBook-Pro:~ catalina$ python3.11 -m folderify -v --no-trim /Users/catalina/Downloads/Fonts/mask.png /Users/catalina/Downloads/Fonts /opt/local/bin/python3.11: No module named folderify Catalinas-MacBook-Pro:~ catalina$ python3 -m folderify -v --no-trim /Users/catalina/Downloads/Fonts/mask.png /Users/catalina/Downloads/Fonts /opt/local/bin/python3: No module named folderify



Is there something else that I need to do, in order to use the legacy version? Why is it that python can't seem to find folderify in order to run it, if it claims that it has been installed?
lgarron commented 10 months ago

Hmm, I'm not sure I can be particularly effective in helping you, given that:

I'd suggest double-checking that the version of Python that is installing folderify is also the same that's trying to run it:

command -va pip3
command -va python3

For me, the /opt/homebrew/bin/ version is first in my $PATH for each.

This works for me:

pip3 install folderify
python3 -m folderify # Invoke as a module
folderify-v2 # Invoke the executable installed by Python
cdn-content commented 10 months ago

It worked! I ended up doing a brew uninstall of the newer one, and doing a reinstall of the legacy version through pip3. Calling folderify-v2 instead of just folderify finally does the trick and doesn't leave a Big Sur folder on my Catalina desktop. Much obliged.