Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install -e fails when run after symlinks are created #1

Closed
DanielKerrigan opened this issue Mar 19, 2023 · 2 comments
Closed

pip install -e fails when run after symlinks are created #1

DanielKerrigan opened this issue Mar 19, 2023 · 2 comments

Comments

@DanielKerrigan
Copy link
Owner

DanielKerrigan commented Mar 19, 2023

pip install -e ".[test, examples, dev]" works the first time, but it fails if it is run again after

jupyter nbextension install --sys-prefix --symlink --overwrite --py svelte_widget
jupyter nbextension enable --sys-prefix --py svelte_widget

or

jupyter labextension develop --overwrite .

The error is

Building wheels for collected packages: svelte_widget
  Building editable for svelte_widget (pyproject.toml) ... done
  Created wheel for svelte_widget: filename=svelte_widget-0.1.0.dev0-py3-none-any.whl size=104783 sha256=3d8ad29dc0e14e42038ae03fb23bc441aaed5cc64dc2f8d52b9242c367b6e9cb
  Stored in directory: /private/var/folders/5d/t5dp0xc505l13313s5wxx9k80000gn/T/pip-ephem-wheel-cache-rho46egu/wheels/8f/77/b1/9dd34722af8eac6f8b25b6915d5cf2d7144d9fe29ae26fc5d1
Successfully built svelte_widget
Installing collected packages: svelte_widget
  Attempting uninstall: svelte_widget
    Found existing installation: svelte_widget 0.1.0.dev0
    Uninstalling svelte_widget-0.1.0.dev0:
      Successfully uninstalled svelte_widget-0.1.0.dev0
  Rolling back uninstall of svelte_widget
  Moving to /Users/danielkerrigan/opt/miniconda3/envs/svelte_widget/etc/jupyter/nbconfig/notebook.d/svelte_widget.json
   from /private/var/folders/5d/t5dp0xc505l13313s5wxx9k80000gn/T/pip-uninstall-gb_yv6d0/svelte_widget.json
  Moving to /Users/danielkerrigan/opt/miniconda3/envs/svelte_widget/lib/python3.11/site-packages/svelte_widget-0.1.0.dev0.dist-info/
   from /Users/danielkerrigan/opt/miniconda3/envs/svelte_widget/lib/python3.11/site-packages/~velte_widget-0.1.0.dev0.dist-info
  Moving to /Users/danielkerrigan/opt/miniconda3/envs/svelte_widget/lib/python3.11/site-packages/svelte_widget.pth
   from /private/var/folders/5d/t5dp0xc505l13313s5wxx9k80000gn/T/pip-uninstall-xcmehlcv/svelte_widget.pth
  Moving to /Users/danielkerrigan/opt/miniconda3/envs/svelte_widget/share/jupyter/labextensions/svelte_widget/
   from /Users/danielkerrigan/opt/miniconda3/envs/svelte_widget/share/jupyter/labextensions/~velte_widget
  Moving to /Users/danielkerrigan/work/research/svelte_widget/svelte_widget/nbextension/
   from /Users/danielkerrigan/work/research/svelte_widget/svelte_widget/~bextension
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/Users/danielkerrigan/opt/miniconda3/envs/svelte_widget/share/jupyter/nbextensions/svelte_widget/extension.js'

I believe this has to do with the symbolic links that are created by those commands.

Running jupyter nbextension uninstall svelte_widget and/or rm /Users/danielkerrigan/opt/miniconda3/envs/svelte_widget/share/jupyter/labextensions/svelte_widget makes the pip install work again. Running pip uninstall also works, but if you run pip install another time, it fails again.

Possibly related:

@DanielKerrigan
Copy link
Owner Author

pip uninstalls the package, fails to install it with the "No such file or directory" error, and then rolls back the uninstall.

When pip is installing the package, it calls the save function for the extension.js file. When this function is called for this file, self.dest_path is:
/Users/danielkerrigan/opt/miniconda3/envs/svelte_widget/share/jupyter/nbextensions/svelte_widget/extension.js
and parent_dir is:
/Users/danielkerrigan/opt/miniconda3/envs/svelte_widget/share/jupyter/nbextensions/svelte_widget.

The parent_dir is a symbolic link to:
/Users/danielkerrigan/work/research/svelte_widget/svelte_widget/nbextension

The call to ensure_dir indicates that the parent_dir, exists, however, opening a new file in this directory fails.

The problem appears to be that the uninstall process deletes the nbextension folder that the symlink points to, but it does not remove the symlink, leaving a broken symlink.

I suppose that this is the correct behavior, since the uninstall is trying to remove the extension from Jupyter extension directory, but since we made the symlink, it removes the local directory instead.

@DanielKerrigan
Copy link
Owner Author

Other than removing the symlinks before running pip install again, you can use pip install --ignore-installed -e ".[test, examples, dev]". This overwrites the package without uninstalling it first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant