What is Recommended Practice for Sharing Projects Across Computers?

Answered

Hello,

I use PyCharm on both my desktop and laptop (both Windows) and I have different projects, mainly for the purposes of running different versions of Python  depending on what I am doing.

Each project and associated venv were on OneDrive so regardless of whether I was on laptop or desktop I could install modules and work on both seamlessly. (Might be worth mentioning: for me, OneDrive was somewhat preferable to version control systems as upload is automatic and it is just me working on these projects.)

This then broke (I think I updated a Python version on one machine, but not another), which led me to consider what is the optimal way to share projects and virtual environments across machines.

I'm aware the topic has been discussed before, but I was looking for some clarification on a few points:

 

I want to be able to install a module in one project on one machine and it to be on the project on the other machine, is this possible?

Having a virtual environment for each project on OneDrive is helpful, but doesn't seem right?! is it preferable to have a virtual environment locally on each machine for each project?

Similar to above, is it necessary to use a different interpreter for each project for each machine? I'm aware these can be set up to use relative paths, which then presumably also require a local install of the interpreter?

 

Apologies if these points are covered elsewhere, any help would be appreciated.

 

Similar questions I've come across, if anyone is interested:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206153889-Sharing-Virtual-Environment-across-machines-Python-plugin

https://stackoverflow.com/questions/14440025/share-a-pycharm-project-across-multiple-operating-systems-different-interpreter

https://stackoverflow.com/questions/49358040/invalid-python-interpreter-when-using-pycharm-to-load-a-project-in-dropbox-which

2 comments
Comment actions Permalink

Hi,

>I want to be able to install a module in one project on one machine and it to be on the project on the other machine, is this possible?

I think the most appropriate option is to use some remote interpreter on both machines. You can then use deployment to upload your code to the remote host automatically instead of using OneDrive for it.

>Having a virtual environment for each project on OneDrive is helpful, but doesn't seem right?! is it preferable to have a virtual environment locally on each machine for each project?

It is advisable to have separate virtualenv for each project, but not necessarily locally. Although PyCharm doesn't officially support working with network drives/folders at the moment.

>Similar to above, is it necessary to use a different interpreter for each project for each machine? I'm aware these can be set up to use relative paths, which then presumably also require a local install of the interpreter?

I guess the first answer also covers it. I think you will agree that having a separate environment for your projects on each machine isn't very convenient and using remote interpreter might be a good option, but it depends on your specific requirements. Though you cannot SSH to Windows machine with PyCharm at the moment.

 

It is, of course, not necessary to use the same interpreter because you can just configure the same environments with the same set of packages. But once you make changes to one environment, you should do the same changes to another environment to keep them equal.

2
Comment actions Permalink

Hi Sergey, thanks for your response, this is very helpful information.

0

Please sign in to leave a comment.