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

PermissionError when starting IPython console kernels on macOS and Linux #21892

Closed
paosferrazza opened this issue Mar 14, 2024 · 10 comments
Closed

Comments

@paosferrazza
Copy link

Description

What steps will reproduce the problem?

The error is:

Traceback (most recent call last):
File "/home/ermes/anaconda3/lib/python3.11/site‑packages/spyder/plugins/ipythonconsole/widgets/main_widget.py", line 2142, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle,
File "/home/ermes/anaconda3/lib/python3.11/site‑packages/jupyter_core/utils/init.py", line 173, in wrapped
return loop.run_until_complete(inner)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ermes/anaconda3/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/ermes/anaconda3/lib/python3.11/site‑packages/jupyter_client/manager.py", line 96, in wrapper
raise e
File "/home/ermes/anaconda3/lib/python3.11/site‑packages/jupyter_client/manager.py", line 87, in wrapper
out = await method(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ermes/anaconda3/lib/python3.11/site‑packages/jupyter_client/manager.py", line 439, in _async_start_kernel
await self._async_launch_kernel(kernel_cmd, **kw)
File "/home/ermes/anaconda3/lib/python3.11/site‑packages/jupyter_client/manager.py", line 354, in _async_launch_kernel
connection_info = await self.provisioner.launch_kernel(kernel_cmd, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ermes/anaconda3/lib/python3.11/site‑packages/jupyter_client/provisioning/local_provisioner.py", line 210, in launch_kernel
self.process = launch_kernel(cmd, **scrubbed_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ermes/anaconda3/lib/python3.11/site‑packages/jupyter_client/launcher.py", line 170, in launch_kernel
raise ex
File "/home/ermes/anaconda3/lib/python3.11/site‑packages/jupyter_client/launcher.py", line 155, in launch_kernel
proc = Popen(cmd, **kwargs) # noqa
^^^^^^^^^^^^^^^^^^^^
File "/home/ermes/anaconda3/lib/python3.11/subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/ermes/anaconda3/lib/python3.11/subprocess.py", line 1950, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/home/ermes/anaconda3/lib/python3.11/site‑packages/spyder/plugins/ipythonconsole/scripts/conda‑activate.sh'

Traceback

Traceback (most recent call last):
  File "/home/ermes/anaconda3/lib/python3.11/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 648, in run_script
    self.get_widget().run_script(
  File "/home/ermes/anaconda3/lib/python3.11/site-packages/spyder/plugins/ipythonconsole/widgets/main_widget.py", line 2343, in run_script
    client = self.create_client_for_file(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ermes/anaconda3/lib/python3.11/site-packages/spyder/plugins/ipythonconsole/widgets/main_widget.py", line 1833, in create_client_for_file
    client.allow_rename = False
    ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'allow_rename'

Versions

  • Spyder version: 5.5.2 (conda)
  • Python version: 3.11.5 64-bit
  • Qt version: 5.15.2
  • PyQt5 version: 5.15.10
  • Operating System: Linux-6.5.0-25-generic-x86_64-with-glibc2.35

Dependencies

# Mandatory:
atomicwrites >=1.2.0             :  1.4.0 (OK)
chardet >=2.0.0                  :  4.0.0 (OK)
cloudpickle >=0.5.0              :  2.2.1 (OK)
cookiecutter >=1.6.0             :  2.5.0 (OK)
diff_match_patch >=20181111      :  20200713 (OK)
intervaltree >=3.0.2             :  3.1.0 (OK)
IPython >=8.13.0,<9.0.0,!=8.17.1 :  8.20.0 (OK)
jedi >=0.17.2,<0.20.0            :  0.18.1 (OK)
jellyfish >=0.7                  :  1.0.1 (OK)
jsonschema >=3.2.0               :  4.19.2 (OK)
keyring >=17.0.0                 :  23.13.1 (OK)
nbconvert >=4.0                  :  7.10.0 (OK)
numpydoc >=0.6.0                 :  1.5.0 (OK)
parso >=0.7.0,<0.9.0             :  0.8.3 (OK)
pexpect >=4.4.0                  :  4.8.0 (OK)
pickleshare >=0.4                :  0.7.5 (OK)
psutil >=5.3                     :  5.9.0 (OK)
pygments >=2.0                   :  2.15.1 (OK)
pylint >=2.5.0,<3.1              :  2.16.2 (OK)
pylint_venv >=3.0.2              :  3.0.3 (OK)
pyls_spyder >=0.4.0              :  0.4.0 (OK)
pylsp >=1.10.0,<1.11.0           :  1.10.0 (OK)
pylsp_black >=2.0.0,<3.0.0       :  2.0.0 (OK)
qdarkstyle >=3.2.0,<3.3.0        :  3.2.3 (OK)
qstylizer >=0.2.2                :  0.2.2 (OK)
qtawesome >=1.2.1,<1.3.0         :  1.2.2 (OK)
qtconsole >=5.5.1,<5.6.0         :  5.5.1 (OK)
qtpy >=2.1.0                     :  2.4.1 (OK)
rtree >=0.9.7                    :  1.0.1 (OK)
setuptools >=49.6.0              :  68.0.0 (OK)
sphinx >=0.6.6                   :  5.0.2 (OK)
spyder_kernels >=2.5.1,<2.6.0    :  2.5.1 (OK)
textdistance >=4.2.0             :  4.2.1 (OK)
three_merge >=0.1.1              :  0.1.1 (OK)
watchdog >=0.10.3                :  2.1.6 (OK)
xdg >=0.26                       :  0.27 (OK)
zmq >=24.0.0                     :  25.1.2 (OK)

# Optional:
cython >=0.21                    :  None (NOK)
matplotlib >=3.0.0               :  3.8.0 (OK)
numpy >=1.7                      :  1.23.5 (OK)
pandas >=1.1.1                   :  1.5.3 (OK)
scipy >=0.17.0                   :  1.10.0 (OK)
sympy >=0.7.3                    :  1.12 (OK)
@ccordoba12
Copy link
Member

Hey @paosferrazza, thanks for reporting. Please open a terminal, run there this command

ls -la /home/ermes/anaconda3/lib/python3.11/site‑packages/spyder/plugins/ipythonconsole/scripts/conda‑activate.sh

and report back the result. That will let us know what's happening in your case.

@paosferrazza
Copy link
Author

paosferrazza commented Mar 14, 2024

~$ ls -la /home/ermes/anaconda3/lib/python3.11/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh
-rw-rw-r-- 2 ermes ermes 518 mar 13 22:15 /home/ermes/anaconda3/lib/python3.11/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh

@remisalmon
Copy link
Contributor

remisalmon commented Mar 14, 2024

Same issue here on macOS, spyder is looking for conda‑activate.sh in site‑packages but the file is conda-activate.sh in site-packages, the dash symbol is a different...

PermissionError: [Errno 13] Permission denied: '<$pathto>/lib/python3.11/site‑packages/spyder/plugins/ipythonconsole/scripts/conda‑activate.sh'
> ls -la <$pathto>/lib/python3.11/site‑packages/spyder/plugins/ipythonconsole/scripts/conda‑activate.sh
ls: cannot access '<$pathto>/lib/python3.11/site‑packages/spyder/plugins/ipythonconsole/scripts/conda‑activate.sh': No such file or directory
> ls -la $pathto/lib/python3.11/site-packages/spyder/
plugins/ipythonconsole/scripts/conda-activate.sh
-rw-r--r-- 3 remisalmon staff 518 Mar 13 15:24 <$pathto>/lib/python3.11/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh

@waeiski
Copy link

waeiski commented Mar 15, 2024

Same issue exists on Linux (Manjaro) as well.

@JC-NH
Copy link

JC-NH commented Mar 15, 2024

Similar error starting kernal

  • Spyder version: 5.5.2 (conda)
  • Python version: 3.12.2 64-bit
  • Qt version: 5.15.2
  • PyQt5 version: 5.15.10
  • Operating System: Linux-5.15.146.1-microsoft-standard-WSL2-x86_64-with-glibc2.35

The error is:

Traceback (most recent call last):
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/site‑packages/spyder/plugins/ipythonconsole/widgets/main_widget.py", line 2142, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle,
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/site‑packages/jupyter_core/utils/init.py", line 165, in wrapped
return loop.run_until_complete(inner)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/site‑packages/jupyter_client/manager.py", line 96, in wrapper
raise e
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/site‑packages/jupyter_client/manager.py", line 87, in wrapper
out = await method(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/site‑packages/jupyter_client/manager.py", line 439, in _async_start_kernel
await self._async_launch_kernel(kernel_cmd, **kw)
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/site‑packages/jupyter_client/manager.py", line 354, in _async_launch_kernel
connection_info = await self.provisioner.launch_kernel(kernel_cmd, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/site‑packages/jupyter_client/provisioning/local_provisioner.py", line 210, in launch_kernel
self.process = launch_kernel(cmd, **scrubbed_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/site‑packages/jupyter_client/launcher.py", line 170, in launch_kernel
raise ex
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/site‑packages/jupyter_client/launcher.py", line 155, in launch_kernel
proc = Popen(cmd, **kwargs) # noqa
^^^^^^^^^^^^^^^^^^^^
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/jim/anaconda3/envs/DSX/lib/python3.12/subprocess.py", line 1953, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/home/jim/anaconda3/envs/DSX/lib/python3.12/site‑packages/spyder/plugins/ipythonconsole/scripts/conda‑activate.sh'

Under "/home/jim/anaconda3/envs" I have two DSX directories. One created 12/30/2022 for which I have no permission to access the lib directory. and one created 3/13/2024 where I do have access to conda-activate.sh

@JC-NH
Copy link

JC-NH commented Mar 15, 2024

As an addendum to the last post: Reverting to spyder 5.5.1, the kernel does now start. While only one DSX environment is listed by "conda env list" the two folders still exist in "/home/jim/anaconda3/envs"

@dalthviz
Copy link
Member

Hi there, checking seems like the conda-activate.sh script is installed without executable permissions :/ Also, as mentioned at #21892 (comment) another thing that is missleading is that in the console error message the dash character is replaced, that causes an error when trying to check the related path in a terminal (with a message that the file/path doesn't exists). As a workaround seems like manually locating and adding executable permission to the conda-activate.sh works so something like:

cd <your env path up to site-packages>/site-packages/spyder/plugins/ipythonconsole/scripts
chmod +x conda-activate.sh

Not totally sure why the script is not preserving the executable bit on, maybe an error happened while I was building the wheel that I didn't noticed? 🤔

@JC-NH
Copy link

JC-NH commented Mar 16, 2024 via email

@ccordoba12
Copy link
Member

Hey everyone, as @dalthviz mentioned, this is caused by conda-activate.sh not having the executable bit on Mac and Linux.

We'll fix that by releasing 5.5.3 as soon as possible with that small change. In the meantime, you can follow @dalthviz's instructions to work around it.

@ccordoba12
Copy link
Member

Closing to get started with the release.

@ccordoba12 ccordoba12 changed the title Kernel doesn't start - permission denied PermissionError when starting the kernel on macOS and Linux Mar 17, 2024
@ccordoba12 ccordoba12 changed the title PermissionError when starting the kernel on macOS and Linux PermissionError when starting IPython console kernels on macOS and Linux Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants