Skip to content

Errors because Spyder can't detect conda when a Conda-based distro is installed in a non-standard location #20357

@anuragsodhi

Description

@anuragsodhi

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

I am facing this issue with spyder 5.4.1. I am trying to use this version of spyder and activate a different python env in which i have spyder kernels 2.4.1 installed. What is strange is if i open anaconda prompt activate the python env containing spyder (and latest 3.11 python) and run spyder from there, change python env to one containing python 3.7 and spyder kernels 2.4.1, i dont get any error. But when i run spyder from windows shortcut, i get this error upon switching to python 3.7 env (which has 2.4.1 kernel)

What steps reproduce the problem?

  1. Make two conda env (one with spyder 5.4.1 and python 3.10 and other with python 3.7 and spyder kernel 2.4.1)
  2. start spyder with windows shortcut
  3. switch to env containing py 3.7. It crashes with folloing error

What is the expected output? What do you see instead?

Paste Traceback/Error Below (if applicable)

Traceback (most recent call last):
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\spyder\plugins\ipythonconsole\widgets\main_widget.py", line 2136, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle,
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\utils.py", line 30, in wrapped
raise e
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\utils.py", line 27, in wrapped
return loop.run_until_complete(future)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\nest_asyncio.py", line 90, in run_until_complete
return f.result()
^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\asyncio\futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "C:\Dev\python_envs\spyder_5_4_1\Lib\asyncio\tasks.py", line 267, in __step
result = coro.send(None)
^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\manager.py", line 90, in wrapper
raise e
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\manager.py", line 82, in wrapper
out = await method(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\manager.py", line 391, in _async_start_kernel
kernel_cmd, kw = await ensure_async(self.pre_start_kernel(**kw))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\utils.py", line 30, in wrapped
raise e
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\utils.py", line 27, in wrapped
return loop.run_until_complete(future)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\nest_asyncio.py", line 90, in run_until_complete
return f.result()
^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\asyncio\futures.py", line 203, in result
raise self._exception.with_traceback(self._exception_tb)
File "C:\Dev\python_envs\spyder_5_4_1\Lib\asyncio\tasks.py", line 267, in __step
result = coro.send(None)
^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\manager.py", line 356, in _async_pre_start_kernel
kw = await self.provisioner.pre_launch(**kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\provisioning\local_provisioner.py", line 193, in pre_launch
kernel_cmd = km.format_kernel_cmd(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\jupyter_client\manager.py", line 265, in format_kernel_cmd
cmd = self.kernel_spec.argv + extra_arguments
^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\spyder\plugins\ipythonconsole\utils\kernelspec.py", line 107, in argv
get_conda_activation_script(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Dev\python_envs\spyder_5_4_1\Lib\site‑packages\spyder\utils\conda.py", line 76, in get_conda_activation_script
if osp.basename(exe).startswith('micromamba'):
^^^^^^^^^^^^^^^^^
File "", line 242, in basename
File "", line 211, in split
TypeError: expected str, bytes or os.PathLike object, not NoneType

Versions

  • Spyder version:
  • Python version:
  • Qt version:
  • PyQt version:
  • Operating System name/version:

Dependencies

PASTE DEPENDENCIES HERE

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions