Start with Debugging an unopened file leads to "Value does not fall within the expected range" error
See original GitHub issueEDIT: Figured out the issue in https://github.com/Microsoft/PTVS/issues/4812#issuecomment-432839834
I am getting very bizarre behavior after update my Anaconda to 5.3.0 (with Python 3.7 now).
In any interactive window, when I try to import numpy
, I get the following:
ConvexOptimization interactive window [PTVS 15.8.18241.1-15.0]
Type $help for a list of commands.
>>> import numpy
Traceback (most recent call last):
File "C:\Users\Joey\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
from . import multiarray
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Joey\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\Joey\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\Joey\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\Joey\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\Joey\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
However if I do the same from the Anaconda Prompt
shortcut, which executes %windir%\System32\cmd.exe "/K" C:\Users\Joey\Anaconda3\Scripts\activate.bat C:\Users\Joey\Anaconda3
, numpy imports fine:
(base) C:\Users\Joey>python
Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> # Good to go
Even weirder, almost all of the python files in my VS Solution can’t be executed anymore. When I “Start without Debugging
”, I get for most of the files “Value does not fall within the expected range
”
However if I make a python 3.6 sub-environment inside anaconda by calling conda create -n py36 python=3.6
, and use that instead of 3.7, I can import numpy, but it doesn’t fix the “Value does not fall within the expected range
” error when I Start without Debugging
.
I’m sharing this in the hopes any of you can help me. Maybe this is a bug, maybe its not. Hope to get to the bottom of this soon.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Yep, that’s exactly it, I see it too. Thanks a lot for the help 😃
I’ll rename this issue to track this, and #4820 will track the numpy/conda activation issue.
@huguesv Figured it out!
Value does not fall within the expected range
happens when you try to execute a python file fromSolution Explorer -> pyfile.py -> Start without Debugging
, AND when the file is not open in a Visual Studio Text Editor window (pyfile.py -> Open
). Something aboutStart without Debugging
is somehow relying on that file being open in a VS text editor window. Is that reproducible? This occurs in a brand-new solution/project.