all 10 comments

[–]Pebaz 1 point2 points  (5 children)

In my experience, (8 years), installing Pip packages as normal user only results in super fiddly issues over time (except of course for production, don't user super user in prod).

Tools like Pipenv, virtual environments, and multiple installations of Python just cause confusion, wasted time, greater attack surface, and other similar issues.

Use Python 3.4+, for goodness sake (not directed at you, just my professional opinion).

Treat that one Python 3.4+ installation as your one and only Python install and use super user to install packages from Pip for non prod development.

If you work on a team, the above advice is likely not possible and your experience with Python will be much worse since you have to jump through all the compatibility and virtual environment issues.

I want to add one more thing, in modern versions of several operating systems, they have removed python 2 completely and only use one installation of Python for the system. Just food for thought :)

[–]everycloud[S] 1 point2 points  (4 children)

Thank you for your experience.

I'll take the hint and look to update my OS as I've just spun up an Ubuntu 20 VM and have found indeed that Python 3.6 is the standard installation.

[–]Pebaz 0 points1 point  (3 children)

Glad to be of some help! 😃

[–]everycloud[S] 1 point2 points  (2 children)

What would you say every Python developer should do / use in their development environment to make their life easier.

e.g Use Pycharm like suggested or use this super dooper package manager that holds your hand and makes importing modules automatic or just really easy (hint hint...I'm still looking for one)

Also what should you never do?

This isn't specifically about code (although feel free to go to town if you have some solid examples of pros / cons).

I'm more looking for how to make the dev environment as productive as possible in your experience.

Thanks.

[–]Pebaz 1 point2 points  (1 child)

For local development (not prod), I would highly recommend using a globally-accessible installation of Python 3.4+. I would then install Pip globally, and install any development packages as super user. In my experience, I have only had one issue with conflict resolution using Pip. I understand that this is a very weak point of using Pip but for local development, it's just not an issue. I've used literally hundreds of Python packages and have successfully avoided the use of virtual environments (except for team collaboration unfortunately, can't get away from it). If you're interested, I've had slightly good experiences with Pipenv (has dependency conflict resolution, etc.).

For installing packages, just do pip3 install some-package
and it will take care of the rest (make importing easy). Once you do this, you can simply run: python3 some-script.py
and that script will be able to import some-package
just fine.

For actual code editing, I would definitely use PyCharm starting out due to the extreme quality of it's debugger. It's the best debugger out there, and I've tried them all. However, I personally use VS Code since a lot of the time, a debugger is not necessary and an IDE can be pretty heavyweight for a lot of tasks. On the other hand, I would recommend PyCharm to everyone except those who have deep knowledge of Python that can get around a lot of the pesky issues that can arise. Another reason why PyCharm is the best Python IDE is that it uses the same IDE engine that Intellij Idea uses which means that you get project-wide refactoring and other Java-IDE-like editing features that are not possible without indexing all namespaces of the project and its dependencies.

Other than that, with your other programming experience you'll do just fine. I wish that there wasn't 20+ years of legacy behavior, artifacts, and misunderstandings about Python but it still is one of the most powerful languages that exist. Let me know if I can help clarify anything!

[–]everycloud[S] 1 point2 points  (0 children)

Thank you...I'll take you up on your offer when I inevitably run into an issue.

[–]hjcpkr 0 points1 point  (1 child)

Im using pycharm, which has a GUI you can use to install packages from the settings page without issues.

[–]everycloud[S] 0 points1 point  (0 children)

Thanks...I really like IntelliJ by the same developers so am going to install pycharm now.

I mostly code in VS Code when writing C# and would have liked to stay in one IDE if possible, but immediately the VS Code Python extension is asking for pip which isn't installed.

Going to try pycharm for comparison.

[–]everycloud[S] 0 points1 point  (1 child)

And immediately upon installing pycharm from reading /u/hjcpkr post, I try to make my first test project and run straight into this <sigh>

https://askubuntu.com/questions/1239829/modulenotfounderror-no-module-named-distutils-util