Some important things to note when one tries to use a remote interpreter in PyCharm:
-
If you are using two instances of PyCharm, e.g. on two differenct machines:
- map the project to a separate folder in the remote disk, the default
/tmp/_______
should be fine, but it could be anywhere. - map the
.pycharm_helper
folder to a separate directory too, e.g. for home machine access create a~/.pycharm_helper_home
to map to.
- map the project to a separate folder in the remote disk, the default
-
If you are using
conda
environments, do the following to actually getconda
working:- suppose you are using an environment called
my_conda_env
, find the location of the python executable, e.g. you can do$ conda activate my_conda_env $ which python
- now you know the path to that python interpreter is for example
.../miniconda3/envs/my_conda_env/bin/python
- now add a file
pycharm_python
to.../miniconda3/envs/my_conda_env/bin/
with the following content:#!/usr/bin/env bash source .../miniconda3/etc/profile.d/conda.sh # <-- here you need to change it to the actual path conda activate my_conda_env python "$@"
- set the remote interpreter to
.../miniconda3/envs/my_conda_env/bin/pycharm_python
in the remote server - to check if conda environment is actually used, in Python Console in PyCharm:
>>> import os >>> print(os.environ.get('CONDA_PREFIX'))
- suppose you are using an environment called
-
Make sure in all settings, e.g.
- "Tools -> Deployment -> Configuration/Options" in top menu bar,
- "Python Interpreter -> Interpreter Settings -> (Gear Icon) -> Show All -> (Pen Icon)" in PyCharm Settings (can be launched from bottom-right corner),
- etc.
-
Make sure when you are deploying by uploading in "Tools -> Deployment -> Upload ...", select the correct file/directory in project tree (usually just select the project root), otherwise not all files are sync-ed.