1

I want to use the embeddable version of python (3.7.0) in an windows 10 environment without need of an installer/admin permissions. Visual Studio Code is the IDE to be configured with the python interpreter above.

To install embeddable python, I followed the instructions of this answer and this issue and it works fine on CLI.

Setup VS Code according to this site:

  • installed Python extension and linter
  • added my python folder (root of python.exe) and subfolder \Scripts in PATH environment: C:/my/path/to/Python,C:/my/path/to/Python/Scripts
  • configured the interpreter like this in user settings: python.pythonPath": "C:/my/path/to/Python/python.exe

Sample script:

msg = "Hello World"
print(msg)

In VS Code I CAN execute the script by right click on active editor -> "Run Python file in terminal".

But I get no IntelliSense:

enter image description here

When I print the sys.path, it gives me

C:\my\path\to\Python\python37.zip
C:\my\path\to\Python\
C:\my\path\to\Python\lib\site-packages

Documentation for Python extension says nothing about embeddable python not been supported:

Install a version of Python 3 (for which this tutorial is written). Options include:

(All operating systems) A download from python.org; typically use the Download Python 3.6.5 button that appears first on the page (or whatever is the latest version).

...

Any ideas how to solve this?

ford04
  • 66,267
  • 20
  • 199
  • 171
  • Have you tried this with the new language server? And have you tried this with other examples (I can make the extension not work for `prin` if I try it immediately after reloading and then not trying again). – Brett Cannon Aug 20 '18 at 19:23
  • I'm not sure what you mean by language server. But I use the latest VS Code 1.26.1 with the python extension 2018.7.1 (23 July 2018) and python 3.7.0. Retried the auto completion a couple of times, did a relative import with another file (`./test2.py`), but it unfortunately didn't change anything. What I noticed : If I try to import the `argparse` package, it says `E0401:Unable to import 'argparse'`. Is that not part of the embeddable python? – ford04 Aug 21 '18 at 09:03
  • Also: If I do the same thing with the distribution "WinPython", it can completely run as embedded version (just referenced the python.exe in VS Code) and works out of the box. But I would really prefer to stick to the "original" embeddable python. – ford04 Aug 21 '18 at 09:05
  • 1
    When you say "embeddable Python" do you mean the embeddable zip file from https://www.python.org/downloads/release/python-370/ ? If so then I wouldn't expect it to work because Python's standard library is put in a zip file and we don't support that. Feel free to open a feature request on our issue tracker if you want for us to support this. – Brett Cannon Aug 21 '18 at 21:53
  • 1
    And what I mean by "language server" can be found in our [July release blog post](https://blogs.msdn.microsoft.com/pythonengineering/2018/07/18/python-in-visual-studio-code-june-july-2018-release/). – Brett Cannon Aug 21 '18 at 21:54

2 Answers2

2

I was using the Python version from Anaconda but I was also not able to get Intellisense to display anything, similar to what you're describing.

In the end, the way that I got Python intellisense to start working in VS Code was to:

  1. open up the Terminal (View menu => Terminal)
  2. type conda init powershell
  3. restart VS Code

After that, Python intellisense started working correctly.

Ron Bertino
  • 141
  • 1
  • 7
1

I had the same issue of IntelliSense not working - nothing displayed and "Loading..." when actively asking for an autocomplete using ctrl + space.

I was on VSCode 1.25.1, an embeddable python 3.8.6, and the Python Extension 2018.7.1

In short, python 3.8 was not supported by the Python Extension 2018.7.1

While IntelliSense failed silently on VSCode, opening Help > Toggle Developer Tools > Console, I had this error:

Python Extension: stderr jediProxy, Error (stderr) Traceback (most recent call last):
  File "d:\Users\user\.vscode\extensions\ms-python.python-2018.7.1\pythonFiles\parso\grammar.py", line 236, in load_grammar
    return _loaded_grammars[path]
KeyError: 'd:\\Users\\user\\.vscode\\extensions\\ms-python.python-2018.7.1\\pythonFiles\\parso\\python\\grammar38.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\Users\user\.vscode\extensions\ms-python.python-2018.7.1\pythonFiles\parso\grammar.py", line 239, in load_grammar
    with open(path) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'd:\\Users\\user\\.vscode\\extensions\\ms-python.python-2018.7.1\\pythonFiles\\parso\\python\\grammar38.txt'

Making a grammar38.txt copy of grammar37.txt is enough to fix IntelliSense in this case - to an extent. If possible, downgrading python or upgrading vscode would be better.

ChoKaPeek
  • 151
  • 9