I am trying to set up a project I have been working on, but on a second machine.
I started and worked on the project on my desktop, but now that school is starting again I would like to be able to work on the project in my spare time.
The project is a git repository, but I am accessing it on my second device from onedrive. This is where I think the issue might be coming from.
I am trying to work on this project in PyCharm.
THE ISSUE:
The venv which is part of the project is kept from onedrive, but its referencing is still based on the file structure of the desktop where I started the project and worked on it so far.
So the interpreter and packaging are not working on this second machine.
MY QUESTION:
Is it possible for me to add a second interpreter for the project, and just switch between them based on which machine I am using?
It looks like the top part of the windows is cut off in that screenshot. There should be separate options for creating a new virtual environment versus adding an existing one. It seems you have selected the option to create a new one, but specified a destination path that already exists. You likely need to either pick a different path (one that doesn’t exist) or if that destination already is a virtual env, switch to adding it instead of creating a new one.
So am I able to add more venv folders? And just name them differently?
Edit:
I have created a venv_laptop folder and that seems to be satisfactory so far, I suppose now I will need to change the .venv in my gitignore to .venv*.
Yes, you can add multiple venv interpreters and switch between them. They need to be named differently in that you can’t have two different venvs with the same path. But it’s fine to have them all in folders named e.g. “venv”, as long as those folders are in different locations.
For what’s it’s worth, when I need to collaborate on a project over both OneDrive and git, I usually set up a slightly different workflow.
Instead of syncing my git workdir over OneDrive, I usually work in an offline workdir and set up a remote git repo inside the OneDrive folder. To sync changes, I push to the OneDrive remote repo and fetch from any other machines, just as I would with an “ordinary” remote over HTTPS/SSH. That helps avoid most syncing / machine-specific mismatch issues.