RicterZ / nhentai

nhentai doujinshi downloader
http://nhentai.net
MIT License
804 stars 112 forks source link

Executable Not Appearing in the Scripts Folder #286

Open BainBernell opened 1 year ago

BainBernell commented 1 year ago

Like it says, the executable is not appearing in the scripts folder upon installing with pip. Sorry if my formatting is off, I pretty much just use github for this and have little to no experience outside of it.

I fresh install Python (through chocolately), which in turn installs pip, which I use to install nhentai (pip install nhentai). (Running everything through admin powershell.) Python Version 3.11.3 / Pip version 23.1.2

Everything appears to install successfully, however when I try to run it I get:

image

But the pip list command shows nhentai 0.5.3 as installed.

image

So the only thing that I can think of that's missing is that it's not creating an executable, because when I go to my scripts folder I don't see the executable that was there when I installed it previously (but I see what I think are all the right files in the site-packages folder in the same area of my python 311 area).

image

image

Addition: Attempted to install using pipx, got an error. (Copy pasted pipx install nhentai into prompt.)

image

Addition 2: Managed to get it "properly" installed using the git installer. Chocolately to install git to manually install nhentai. This has unfortunately not fixed my error, as now I... just have a new error. (Plus it doesn't fix the fact that the executable is missing from a pip install.)

image

Anyways, if this is user error please let me know what I'm doing wrong (or if any additional information is required), I had it working before but had to reinstall (leading to the current predicament).

BainBernell commented 1 year ago

Update: Leaving the issue open since I'm still not sure what the hell went wrong with my original attempt, but I did manage to get it functional with git. Adding this comment in case anyone else has an issue similar to mine.

Uninstalled Python and Git for a fresh environment (left chocolatey). Installed Python using Chocolatey. Installed Git using Chocolatey. Installed Setuptools using python (pip). Installed nhentai downloader via manual installation (from github).

Voila, functional nhentai downloader.

Kayot commented 1 year ago

I'm having this same issue. I can't install nhentai on Windows 11 or Ubuntu 22.04 through pip. I just reinstalled my server which is why I'm trying to install it fresh. I was able to install it using the source download. Ended up ditching the windows store version of python, but looking back it really just came down to adding to path;

%USERPROFILE%\AppData\Local\Programs\Python\Python311 %USERPROFILE%\AppData\Local\Programs\Python\Python311\Scripts\

So I think it's just the pip version that isn't working correctly.

OkamiNoKage commented 1 year ago

I've got this problem too. Tried to install it with pipx on my EndeavourOS installation, but no chance. The 2 packages normalizer and tabulate are getting installed just fine, but not the nhentai executable. Tried to install img2pdf with pipx to try if my setup is broken, but it gets installed without problem. To me it looks like the executable is just not getting created.

gcscaglia commented 1 year ago

Just another data point: I've had the same problem. For me, simply downgrading to nhentai==0.4.18 solved the issue with the script not being installed.

Auvski commented 10 months ago

This issue occurred to me as well using the latest master, pip version 2.0.4, and Python version 3.10.12 on Ubuntu 22.04. I fixed it by manually creating the executable myself.

First off, it's generally a good practice to do all of your Python stuff in a virtualenv, like this:

# create new virtualenv called "env" (you can rename it to whatever you want)
python3 -m venv env
# activate virtualenv, which adds shims to the path
source env/bin/activate
# note: I actually use activate.fish since I use the fish shell, but same effect

Now, activating the virtual env adds a path shim for path/to/our/env/bin. Here we can pip install the latest version of nhentai or manually git clone the repo, make adjustments as desired, and then pip install -e . Either way works, as long as you've used pip to install the library after creating your virtual env.

The next step is creating the executable. I chose to call mine nh but you can call it whatever. Open the file env/bin/nh and enter the following:

#!/full/path/to/your/env/bin/python3
from nhentai.command import main
if __name__ == '__main__':
    main()

And that's it! Just save and you're done. Make sure to replace the first line above with the full path to wherever you've made your env. You'll need to run the source env/bin/activate command in any new shell in order to access this tool.

PedroHenriqueFonsecaMelo commented 6 months ago

(Problem solved, please ignore this comment)

Hello @Auvski , could you better explain how you created this executable? When I create it with pyinstaller --onefile it gives an error because it cannot find the config.json (template)

Auvski commented 5 months ago

@PedroHenriqueFonsecaMelo I'd never heard of pyinstaller before this. I think you've misunderstood what I meant by executable: I didn't mean an .exe file like in Windows, I meant literally a piece of data that can be executed. I'm running under WSL, the Windows Subsystem for Linux, and in the Linux world, an executable can just be a plain text file with a shebang written at the top. This is the short bit of text I wrote out above - that's the entire content of the file ..../env/bin/nh.

If you're not running on Linux or MacOS or WSL, then I'm not sure how helpful my advice is.

jjmaster69 commented 5 months ago

Just another data point: I've had the same problem. For me, simply downgrading to nhentai==0.4.18 solved the issue with the script not being installed.

@gcscaglia I am a newbie in python. I just want to know how do you downgrade it. I downloaded the 0.4.18 zip file, deleted and uninstalled 0.5.3. I also tried reinstalling python but whenever I ran the pip install prompt, I would get version 0.5.3 instead. How do I fix it.

PedroHenriqueFonsecaMelo commented 4 months ago

@jjmaster69 in your terminal of choice, type the following:

pip install --force-reinstall nhentai==0.4.18

If after all you can't get the executable, try:

pip install --force-reinstall --user nhentai==0.4.18

This way, it will be downloaded to your username and there will be no need for admin keys.

PedroHenriqueFonsecaMelo commented 4 months ago

@Auvski Thanks for the comment but I ended up getting the program to work properly