jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
934 stars 185 forks source link

allow editable installation #363

Closed akaszynski closed 2 years ago

akaszynski commented 2 years ago

While following the instructions at CONTRIBUTING.md, I encountered an issue when running pip install -e . --user on a user account:

Installing collected packages: pythreejs
  Attempting uninstall: pythreejs
    Found existing installation: pythreejs 2.3.0
    Uninstalling pythreejs-2.3.0:
      Successfully uninstalled pythreejs-2.3.0
  Running setup.py develop for pythreejs
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/alex/python/pythreejs/setup.py'"'"'; __file__='"'"'/home/alex/python/pythreejs/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --user --prefix=
         cwd: /home/alex/python/pythreejs/
    Complete output (30 lines):
    running develop
    /tmp/pip-build-env-kulmcb7y/overlay/lib/python3.8/site-packages/setuptools/dist.py:484: UserWarning: Normalizing '2.3.1dev0' to '2.3.1.dev0'
      warnings.warn(tmpl.format(**locals()))
    WARNING: The user site-packages directory is disabled.
    error: can't create or remove files in install directory

    The following error occurred while trying to add or remove files in the
    installation directory:

        [Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/test-easy-install-514511.write-test'

    The installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:

        /usr/local/lib/python3.8/dist-packages/

    Perhaps your account does not have write access to this directory?  If the
    installation directory is a system-owned directory, you may need to sign in
    as the administrator or "root" account.  If you do not have administrative
    access to this machine, you may wish to choose a different installation
    directory, preferably one that is listed in your PYTHONPATH environment
    variable.

    For information on other options, you may wish to consult the
    documentation at:

      https://setuptools.readthedocs.io/en/latest/easy_install.html

    Please make the appropriate changes for your system and try again.

It looks like it's trying to install on the system dist directory despite being passed the --user flag.

This seems to be a common issue, see https://github.com/pytorch/fairseq/issues/1977. As such, this PR implements the same fix as pointed out in https://github.com/pytorch/fairseq/issues/1977

vidartf commented 2 years ago

There's a user side specific workaround that has been suggested as well: https://github.com/pypa/pip/issues/7953#issuecomment-954755720