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

NotADirectoryError: [Errno 20] Not a directory: '/Users/name/python' & The operation can’t be completed because the original item for “python” can’t be found. #7117

Closed
jkiefn1 opened this issue Oct 19, 2023 · 1 comment
Labels
bug status:Needs Triage Applied to issues that need triage

Comments

@jkiefn1
Copy link

jkiefn1 commented Oct 19, 2023

After upgrading to Python 3.11.5, I encountered compatibility issues. After some research, found it was likely due to site-packages being installed via the normal python3.11 -m pip install x but python3.11 being (at that time) installed via homebrew.

I've since uninstalled python3.11.5 via brew and reinstalled manually (same version), cleared the PATH variables to where export PATH="/Library/Frameworks/Python.framework/Versions/3.11/bin:$PATH" is the only entry, but now an error is getting thrown upon launch via python3.11 -m jupyter notebook that states a file being referenced is hidden or not a directory.

The file in question is a python alias that no longer functions properly--when clicked it returns a message saying The operation can’t be completed because the original item for “python” can’t be found.

Oddly enough, when re-naming the alias to "python-old" and creating a new alias called "python" that points to a functioning version, the below stack-trace references the "python-old" file as if even when re-named it is still link as THE version to reference.

Python3.11 works properly. Writing and running .py files from the IDLE works properly. Launching (and running) apache airflow from the command line and webserver interface works properly. For all intents and purposes, everything is working as intended--the only thing that is corrupt is this alias--which I can't recreate, re-name, or move.

Pretty perplexed here.

Full stack trace below. Good stuff is towards the bottom.

name@name-MBP ~ % python3.11 -m jupyter notebook
[I 2023-10-19 12:06:06.980 ServerApp] Package notebook took 0.0000s to import
[I 2023-10-19 12:06:06.993 ServerApp] Package jupyter_lsp took 0.0131s to import
[W 2023-10-19 12:06:06.993 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-10-19 12:06:06.999 ServerApp] Package jupyter_server_terminals took 0.0052s to import
[I 2023-10-19 12:06:06.999 ServerApp] Package jupyterlab took 0.0000s to import
[I 2023-10-19 12:06:07.422 ServerApp] Package notebook_shim took 0.0000s to import
[W 2023-10-19 12:06:07.422 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-10-19 12:06:07.423 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2023-10-19 12:06:07.426 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2023-10-19 12:06:07.428 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-10-19 12:06:07.431 ServerApp] notebook | extension was successfully linked.
[I 2023-10-19 12:06:07.778 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-10-19 12:06:07.812 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-10-19 12:06:07.813 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2023-10-19 12:06:07.814 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2023-10-19 12:06:07.817 LabApp] JupyterLab extension loaded from /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyterlab
[I 2023-10-19 12:06:07.817 LabApp] JupyterLab application directory is /Library/Frameworks/Python.framework/Versions/3.11/share/jupyter/lab
[I 2023-10-19 12:06:07.817 LabApp] Extension Manager is 'pypi'.
[I 2023-10-19 12:06:07.819 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-10-19 12:06:07.821 ServerApp] notebook | extension was successfully loaded.
[I 2023-10-19 12:06:07.822 ServerApp] Serving notebooks from local directory: /Users/name
[I 2023-10-19 12:06:07.822 ServerApp] Jupyter Server 2.8.0 is running at:
[I 2023-10-19 12:06:07.822 ServerApp] http://localhost:8888/tree?token=a76dfc09da3fe88415fe110a6a210f47e3d07d9d95453636
[I 2023-10-19 12:06:07.822 ServerApp]     http://127.0.0.1:8888/tree?token=a76dfc09da3fe88415fe110a6a210f47e3d07d9d95453636
[I 2023-10-19 12:06:07.822 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-10-19 12:06:07.827 ServerApp] 
    
    To access the server, open this file in a browser:
        file:///Users/name/Library/Jupyter/runtime/jpserver-18825-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/tree?token=a76dfc09da3fe88415fe110a6a210f47e3d07d9d95453636
        http://127.0.0.1:8888/tree?token=a76dfc09da3fe88415fe110a6a210f47e3d07d9d95453636
[I 2023-10-19 12:06:08.368 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[W 2023-10-19 12:06:10.894 ServerApp] Unknown error checking if file '/Users/name/python' is hidden
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyter_server/services/contents/filemanager.py", line 768, in _dir_model
        self.allow_hidden or not is_file_hidden(os_path, stat_res=st)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyter_core/paths.py", line 433, in is_file_hidden_posix
        stat_res = os.stat(abs_path)
                   ^^^^^^^^^^^^^^^^^
    NotADirectoryError: [Errno 20] Not a directory: '/Users/name/python'
[W 2023-10-19 12:06:10.985 ServerApp] Unknown error checking if file '/Users/name/python' is hidden
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyter_server/services/contents/filemanager.py", line 768, in _dir_model
        self.allow_hidden or not is_file_hidden(os_path, stat_res=st)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyter_core/paths.py", line 433, in is_file_hidden_posix
        stat_res = os.stat(abs_path)
                   ^^^^^^^^^^^^^^^^^
    NotADirectoryError: [Errno 20] Not a directory: '/Users/name/python'
@jkiefn1 jkiefn1 added bug status:Needs Triage Applied to issues that need triage labels Oct 19, 2023
@jkiefn1 jkiefn1 closed this as completed Oct 20, 2023
@jkiefn1
Copy link
Author

jkiefn1 commented Oct 20, 2023

Although doing this manually had no effect, creating a simlink from /Users/name/python to /directory/for/requisite/version/of/python fixed the issue. Closing this out, as it was not a bug, rather user error.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug status:Needs Triage Applied to issues that need triage
Projects
None yet
Development

No branches or pull requests

1 participant