Here is how the thing doesn't work:
The project source code is located on a remote machine. The Python virtual environment is installed in the project's root directory (using venv).
I sshfs the project folder and start local VSCode. It detects the virtual environment, but doesn't see pylint or other packages installed in it.
Python 3.6.7
VS Code - latest version
OSs - Debian 9 remote, Linux Mint 19 local
Both sshfs connection and venv installation are performed under the same account.
Is there some special way a virtual environment should be set up to be usable remotely?
There were problems with sshfs in early VSCode versions, but recent distrib has Remote Development extension that lets you develop your code via ssh.
Since you have activated your virtual environment, just get venv python path with which python command and copy it to the Select Interpreter menu.
Activate your python environment:
source venv/bin/activate
Find which python path you are using:
which python
Usually it is in :
venv/bin/python
Go to the bottom of VS Code, and click on the version number :
Click on Enter interpreter path... :
Enter the path you found above with the which python command.
Related
I'm trying to use Visual Studio Code with both Anaconda and Python for Windows.
I have both installed, and I have the visual studio code extensions for both.
But no matter what I do now the Conda Base gets activated -
(base) PS C:\Users
even though the Python for Windows is the selected version
or if I try to activate an environment I get a mix of both, the venv with python for windows and the conda base activated.
(venv_iocparser) (base) PS C:\Users\
The settings.json file in this folder only has python for windows in the 'python.pythonPath'; with no mention of conda, but still activates the conda base.
Does anyone know a good article that walks through setting VSCode up with both? With python for windows as the default?
Thank you!
Had a similar issue. Its most likely since you installed VS Code with Anaconda, for some reason or another it just assumes thats what env you want when starting it.
To get out of it just run $ conda deactivate and then activate whatever env you want after that. I fixed it by changing the PATH for the python to only point at the non-conda versions though. I also had uninstalled it all and reinstalled it all at one point though.
I have a python installation within a virtual environment on an Ubuntu server 18.04. Within the virtual environment I have installed Spyder and iPython and Jupyter.
My requirement is: I need to open a local installation of VSCode or Spyder on a different computer (Windows / Mac / Linux) and run my codes on the virtual environment on the Ubuntu server.
A guide would be highly appreciated!
(Spyder maintainer here) Please take at our documentation to learn how to connect our console to a remote kernel.
Spyder variable explorer works fine for a local kernel; however, it does not work for the remote kernel. Indeed, the connection to the kernel and running the codes works well but non of the variables are shown in the varibale explorer.
Here is some information:
Python 3.6.8 64-bit | Qt 5.9.4 | PyQt5 5.9.2 | Linux 4.9.0-6-amd64
I also unmarked all filters in "Preferences>Variable explorer>Filter" and followed the posts below but no improvement.
https://github.com/spyder-ide/spyder/issues/7850
Spyder does not show lists and arrays in variable explorer
spyder-kernels is installed in both local and remote machines.
the connection is through SSH.
Spyder is up to date.
Thanks in advance for your helps.
Had the same problem, objects didn't show up in spyder - variable explorer, fixed it by creating a new env and fresh install for spyder kernels
Create new env
conda create --name python3test python=3
Activate env
conda activate python3test
Install kernel for spyder
conda install spyder-kernels
Generate new kernel and then quit - store kernel name
python -m spyder_kernels.console
Connect to kernel
python -m spyder_kernels.console -f kernel-XXXX.json
Download kernel json file (for me was to Win), launch Spyder and connect to kernel.
How can I make my GTK3+ Python script work outside of Msys2's own Python interpreter, into my own venv (virtual environment) Python3 interpreter? I want to prepare my Python 3 script for distribution to other computers, but without Msys2.
I'm using Windows 10.
I've successfully followed the instructions on GTK's website, to download GTK3+ and the Python bindings, in Windows.
I've installed GTK3+ and the Python bindings using MSYS2. My script runs successfully within MSYS2's Python3 interpreter in C:\msys64\mingw64\bin. However, I want to run my Python script outside of MSYS2, with a separate Python 3 interpreter (venv) - not the one in MSYS2.
From my research, it seems that I need to copy the GTK3 .dll files and icons from
C:\msys64\mingw64\bin
and C:\msys64\mingw64\share
to the Python3 interpreter path that I want, with my script files in there too.
But when I attempt to run my script in the virtual environment, I get:
builtins.ImportError: cannot import name '_gi' from 'gi'
Any ideas? Thanks.
I don't know if that is possible.
But if the final intent is to distribute your app, then you should install PyInstaller inside MSYS2 and generate an executable there. Then you'll be able to distribute and execute your app on any Windows machine.
It will only be possible to run your program using the MSYS2 Python interpreter and with all of the required libraries. You can't just copy files and then run them with the Windows Python interpreter that was built using MSVC.
PyInstaller is a good solution to package an app with the interpreter and all of the libraries. The issue you mentioned about getting errors about no module named '_struct' has been fixed.
How do i configure Kdevelop enviroment on windows to point to my anaconda python installation. I have already set the path on windows. The configure enviroment variable does not have the option to put the path rather it gives the option to enter variable and value.
!https://drive.google.com/open?id=1zcfVGZb8-bKGkw9ww2I4PjBa8yIH9QvG