xlcnd/isbntools

Links to isbntools in /usr/local/bin are outdated/gone

Closed this issue · 7 comments

I have installed isbntools on two machines with macOS 10.13.6 and 10.14.6, respectively. On both machines, the programs had been working before.

Now, when I try to run isbntools, on one machine, I see that all the links to the individual programs in /usr/local/bin have gone.
When I try to delete and reinstall with pip3 install isbntools, I get

Collecting isbntools
  Using cached isbntools-4.3.23-py2.py3-none-any.whl (39 kB)
Requirement already satisfied: isbnlib<3.11.0,>=3.10.1 in /usr/local/lib/python3.7/site-packages (from isbntools) (3.10.3)
Installing collected packages: isbntools
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/isbntools/isbntools.conf'
Consider using the `--user` option or check the permissions.

On the second machine, the files in /usr/local/bin are still there, but they reference Python3.6 - which is no longer installed on the system - and isbntools 4.3.14, even though 4.3.23 is installed.
So there must be something wrong with the installation/update mechanism, but I can't figure out what.

xlcnd commented

Hi.

Have you tried pip install --user isbntools?

Have you tried pip install --user isbntools?

Yes. While this command shows no errors, after running isbntools it gives -bash: isbntools: command not found.

Running pip3 -v install isbntools produces the following error:

ERROR: Could not install packages due to an EnvironmentError.
Consider using the `--user` option or check the permissions.
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 407, in run
    use_user_site=options.use_user_site,
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/req/__init__.py", line 71, in install_given_reqs
    **kwargs
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 811, in install
    direct_url=direct_url,
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/install/wheel.py", line 630, in install_wheel
    direct_url=direct_url,
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/install/wheel.py", line 453, in install_unpacked_wheel
    clobber(source, dest, False, fixer=fixer, filter=filter)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/install/wheel.py", line 380, in clobber
    ensure_dir(destdir)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/utils/misc.py", line 111, in ensure_dir
    os.makedirs(path)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/isbntools'

Why does the script want to create a folder /usr/local/isbntools? All binary files should be created in /usr/local/bin.
The creation of this directory obviously fails because the permissions of /usr/local/ are set as
owner: root, group: wheel

Also, if attempting to remove isbntools with pip3 uninstall isbntools, none of the isbntools scripts in /usr/local/bin are actually removed.

xlcnd commented

All these problems are related with how pip3 works in your system! isbntools doesn't use any special installation code.

The creation of isbntools directory, once again, is how pip tries to install data files in your system. You should check the documentation of pip3 for your system!

My suggestion is that you install isbntools (and other similar apps) inside a virtual environment.

All these problems are related with how pip3 works in your system! isbntools doesn't use any special installation code.

The creation of isbntools directory, once again, is how pip tries to install data files in your system. You should check the documentation of pip3 for your system!

This issue is not related to "how pip works on my system", because

  1. the Python version that is installed with homebrew has no modifed pip/pip3
  2. in the meantime, I have installed several other Python packages that have a CLI with pip3 install PACKAGE (e.g. html2text, Django). None of those had any issue putting their CLI .py into /usr/local/bin/
xlcnd commented

As I said before, the issue is "how pip works in your system", namely how pip installs data files in your system! Does, the packages you mention, have data files to install?

The isbntools package as no special "setup" code, so is pip who installs the package!

xlcnd commented

But you could try the following procedure:

  1. Download the package
  2. Unzip it to a folder and go to that folder
  3. Edit the file setup.py and delete the line data_files=[('isbntools', ['isbntools/isbntools.conf'])],
  4. Enter pip install .

After unsuccessfully trying various approaches to find the cause of this issue, at least I was finally able to get it installed by using pip -v install -e git+https://github.com/xlcnd/isbntools.git#egg=isbntools