0
votes

I am working on a python project in Pycharm. Lately I have created a setup.py in order for collaborators to be able to install and test the project on their systems. To test that everything is working fine, I have also installed it in my conda environment, which is the same as used by the interpreter in my Pycharm project. Now when I import my package in Pycharm it gets imported from the conda environment and not from my Pycharm project. Is there a way to tell Pycharm to look first in the Pycharm project subdirectories and then in the conda environment? Or do I need to uninstall my package from the conda environment that I use in Pycharm?

1

1 Answers

1
votes

The proper way to go is to first create a virtual environment and then install your package in editable mode along with its required dependencies, as specified in setup.cfg.


Step 1: Activate your virtual environment

source /path/to/your/venv/bin/activate

or

conda activate vevnName

Step 2: Install your package in editable mode

pip3 install -e .

This command is going to install your package and link it to the original location (i.e the one that probably you want to be editing in PyCharm) so that any change being made is also replicated on your venv.


You can now open your Python application on PyCharm, from its original location and any changes you make in your IDE will be reflected directly on your virtual environment.