Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Conda activation problem on ptvsd 5.x #2055

Closed
huguesv opened this issue Jan 23, 2020 · 4 comments
Closed

Conda activation problem on ptvsd 5.x #2055

huguesv opened this issue Jan 23, 2020 · 4 comments
Assignees
Labels

Comments

@huguesv
Copy link
Contributor

huguesv commented Jan 23, 2020

Describe the bug
Conda activation doesn't work with ptvsd 5.x (but works when debugging with 3.x or when launching without debugging). This is using VS 2019 dogfood build 16.5 Preview 3.

Steps to Reproduce
Easiest way to demonstrate is to check if numpy loads successfully in a conda env.

  1. Create a new python app
  2. Create a conda environment and install python=3.7 numpy
  3. Debug (F5) this code
import numpy
print(numpy.__version__)

Expected behavior
Runs without error

Additional context and screenshots

Loaded 'numpy.core'
Loaded 'numpy'
Loaded '__main__'
Loaded 'runpy'
Traceback (most recent call last):
  File "C:\Users\huvalo\.conda\envs\condaenv23b\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
    from . import multiarray
  File "C:\Users\huvalo\.conda\envs\condaenv23b\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
    from . import overrides
  File "C:\Users\huvalo\.conda\envs\condaenv23b\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.
@huguesv huguesv changed the title Conda activation not working Conda activation not working with ptvsd 5.x Jan 23, 2020
@huguesv
Copy link
Contributor Author

huguesv commented Jan 23, 2020

ptvsd.launcher-10228.log
ptvsd.server-11724.log
ptvsd.adapter-10092.log

One thing that is suspicious is that the launcher logs show that the environment variables used by the adapter to launch the program have both a PATH entry and a Path entry.

@huguesv huguesv changed the title Conda activation not working with ptvsd 5.x Conda activation problem on ptvsd 5.x Jan 23, 2020
@huguesv huguesv transferred this issue from microsoft/PTVS Jan 23, 2020
@int19h
Copy link
Contributor

int19h commented Jan 23, 2020

Yeah, it does treat environment variable names as case-sensitive (which they are on Unix), so "Path" and "PATH" end up separate. We should do case normalization for "env" keys in the adapter on Windows.

Is there any particular reason why it's "Path", by the way? The canonical name is uppercase. If we control the code that creates that var, this should probably be fixed. Or does it come from the conda activation script?

@int19h int19h added the Bug label Jan 23, 2020
@int19h int19h self-assigned this Jan 23, 2020
@huguesv
Copy link
Contributor Author

huguesv commented Jan 23, 2020

It comes back as "PATH" from the conda activation script in Python.
It comes back as "Path" when calling System.Environment.GetEnvironmentVariables() in C#.
Eventually we merge them using a case-insensitive dictionary and we end up with "Path".

@int19h
Copy link
Contributor

int19h commented Jan 29, 2020

Fixed.

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

No branches or pull requests

2 participants