Closed cristi-neagu closed 5 years ago
Thanks for reporting this issue. However to help you we need more information, please could you take the Time to fill in the issue template.
I have the same (or a very similar) issue.
"python.jediEnabled"
set to; more info #3977): trueVS Code picks up the Conda environment specified in my python.pythonPath
folder setting when starting the Python Interactive session, e.g. /Users/<redacted>/anaconda3/envs/<my_env>/bin/python
VS Code only picks up the base Conda environment:
Jupyter Server URI: http://localhost:8889/?token=<redacted>
Python version:
3.7.3 (default, Mar 27 2019, 16:54:48) \n[Clang 4.0.1 (tags/RELEASE_401/final)]
(6, 0, 0)
/Users/<redacted>/anaconda3/bin/python
my_env
conda environment (from an external terminal shell)
conda create -n my_env python pylint pyface
Python: Select Interpreter
command, for some folder in the multi-root workspace, select the my_env
conda environment.py
file in the folder
#%%
import pyface
Run Cell
to start a Python Interactive sessionOutput for cell [1]
in the Python Interactive
window
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import pyface
ModuleNotFoundError: No module named 'pyface'
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
> conda env list
> conda info --json
> ~/anaconda3/bin/python -m jupyter notebook --version
> ~/anaconda3/bin/python -m jupyter kernelspec --version
> ~/anaconda3/bin/python -m jupyter kernelspec list
> ~/anaconda3/bin/python -m jupyter kernelspec list
> ~/anaconda3/bin/python -m jupyter notebook --no-browser --notebook-dir=/var/folders/q5/pspsf7q94qlbhdn41jqr6_080000gn/T/da9e7816-c209-412e-bfa5-86fa1de7eab3 --config=/var/folders/q5/pspsf7q94qlbhdn41jqr6_080000gn/T/da9e7816-c209-412e-bfa5-86fa1de7eab3/jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0
> ~/anaconda3/bin/python ~/.vscode/extensions/ms-python.python-2019.8.30787/pythonFiles/datascience/getServerInfo.py
> ~/anaconda3/bin/python ~/.vscode/extensions/ms-python.python-2019.8.30787/pythonFiles/datascience/getServerInfo.py
> ~/anaconda3/bin/python -m ipykernel --version
I found https://github.com/microsoft/vscode-python/issues/3123 to be the culprit. My workaround is to move up my project to be the first folder in my multi-root workspace
@cristi-neagu, does that workaround help you?
Hello,
I apologise for not responding to this earlier. Limited time and all that. I shall respond tomorrow with the requested template.
@ericsnowcurrently Unfortunately no, since it's not a multi-root workspace. It's just one folder. Like i said in my initial post, i don't think this is something caused by VS Code or by the Python extension. Something broke somewhere in my setup, it's just that i don't even know where to start. In any case, i shall post that template tomorrow.
Thank you.
Looks like the original issues isn't data science specific. Removing the label.
Hello,
It used to be the case that when i ran a script in debug within a conda environment, the first time it would fail with the error
ImportError: DLL load failed: The specified module could not be found.
Right after the debugger would end, the console would runconda activate
to activate the environment, and running the script again would function correctly.But that isn't happening any longer. A few days ago i updated conda (using the prompt), and something went wrong and Anaconda shortcuts disappeared from the Start Menu. I reinstalled conda in the exact same location, and it is working fine. Jupyter Notebook launches correctly, runs ok, no problems. But now VS Code doesn't activate the environment any longer. It does see the environments and i can select them. It does seem to use the selected environment, as it complains about pylint not being installed if i switch to an environment with no pylint.
I tried adding the conda folder to the path. This actually worked for 1 session of using VS Code, and now it doesn't work any longer, with me not changing absolutely anything. I tried initializing
cmd.exe
for use with conda, so now i can typeconda activate
in the Python debug terminal and it does activate the terminal and the script can run. But VS Code is still not doing it automatically.Also, when i installed conda, i did select the option that makes it visible to VS Code. I forget the actual wording, but it was on the same screen as the "add to path" option.
At this point i don't even know if this is a conda issue, a VS Code issue, or a Python extension issue. Any ideas are welcome.
Thank you.