[root tip] [How To] Avoid common pitfalls as developer

Spend your time coding

As a long time developer - using Arch and Manjaro - I can tell from experience - having your workflow broken is extremely stressing - especially due to system issues.

Issues you can avoid and I will share with you - how to avoid them.

Spend your time coding instead of fixing system issues.

Development tools

Users new to Manjaro and development is often trapped with unnecessary problems and issues, due to how Manjaro and Arch package management works.

When using Python, NodeJS and JetBrains tools using a simple set rules and you will avoid issues which otherwise would have cost you hours to fix.

Python

Always install system wide packages using pacman

sudo pacman -Syu python-pkgname

NEVER use sudo pip

This is likely to create maintenance Failed to commit transaction issues at a later stage so avoid

sudo pip install pkgname

If you need PyPi package use the --user argument and from 3.11 and onwards you add --break-system-packages. This has been implemented upstream to ensure the user is aware of the implications.

pip install --user --break-system-packages pkgname

Use a virtual environment if you need PyPi

Install a virtual environment using pacman - one example is python-virtualenvwrapper

sudo pacman -Syu python-virtualenvwrapper

Then source the wrapper script in your .bashrc or .zshrc or on the commandline

source /usr/bin/virtualenvwrapper.sh

Use commands like

mkvirtualenv my-project

Cd to your project folder and run your scripts - install the python packages needed etc.

To set your python environment for my-project

workon my-project
pip install numpy

When you are done

deactivate my-project

Node JS

Nodejs is often installed as dependency for other packages e.g. Electron based apps.

Never mess with the system nodejs.

Never install node packages using sudo

This also likely to create maintenance Failed to commit transaction issues at a later stage so avoid

sudo npm install -g gulp
sudo npm install http

Use a node version manager

One option is to use pnpm which is a nodejs package manager for your project (packaged for Manjaro by @Yochanan )

sudo pacman -S pnpm

Another option is NVM a node version manager - which installs, runs and maintain nodejs in your home folder - and you can install and run different versions of nodejs - something that is impossible using the package manager - where you will always be forced to use a specific version

sudo pacman -S nvm

Install a nodejs interpreter - you can install several if necessary and switch between them

nvm install node

Then install node packages - even global packages - using commands like this

npm install -g gulp
npm install http

JetBrains tools

You can install JetBrains tools from AUR - but they are installed into /opt and thus requires superuser when the tool informs you that updates are available.

It is better using the Jetbrains Toolbox App to install the tools.

If you are using a single app e.g. PyCharm, PhpStorm or WebStorm and you don’t want or need the Toolbox

  • download the archive
  • unpack it in your home.
  • navigate into the unpacked folder
  • run the app’s launcher script from the bin folder.

Android Studio

Android Studio is based on IntelliJ - the core of all JetBrains tools - install it using the Toolbox App or download from android.com

  • download the archive
  • unpack it in your home.
  • navigate into the unpacked folder
  • run the app’s launcher script from the bin folder.

dotnet core SDK

The packages in the repo is mostly runtime packages.

As developer you want all binaries provided by the current dotnet core LTS and there is only one viable method to achieve this on one step using an Arch based distribution.

This is a custom package - jump to the custom dotnet package article to learn how.

To educate yourself on use of AUR and why it is unsupported please jump to article About Manjaro and AUR

Conclusion

Have fun developing and educating yourself in the fantastic and endless world of coding.

14 Likes

8 posts were split to a new topic: Discussion about avoiding common pitfalls as developer

Another simple option

Use pipx instead of pip, it creates an environment in your home directory.
It is available in pacman repos.

Closely related to pip, but creates, for the user running it, an isolated environment for each application and its associated packages, preventing conflicts with system packages. Focused on packages that can be run from the command line directly as applications. You can use pipx to install packages from the Python Package Index and other indexes.

Source: Python - ArchWiki

1 Like