[HowTo] Avoid pacman transaction failures

Avoid pacman transaction failures

Whether you are a developer by trade or you are a hobby coder there is nothing more annoying than update issues due to conflicting files and cancelled transactions.

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 could have avoided 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 please follow these simple rules and you will steer clear of many system issues which otherwise would have cost you hours to fix.

  • Python
  • Node.js
  • Android Studio
  • JetBrains tools

Python

Always install system wide packages using pacman

sudo pacman -Syu python-pkgname

NEVER use sudo pip

sudo pip install package

The above example will create file conflicts when you update your system

ALWAYS use a virtual environment

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

Never install nodejs and npm using pacman

You will inevitable run into file conflicts on system updates.

Never install node packages using sudo

If you install nodejs using pacman you are forced to install node packages using sudo which will create file conflicts.

NEVER USE sudo npm

sudo npm install -g gulp
sudo npm install http

Always use NVM

NVM is node version manager - which runs node 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

nvm.sh project on Github

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

Then run

nvm install node

ALWAYS DO install node packages - even global packages - using commands like this

npm install -g gulp
npm install http

Android Studio

Android Studio is based on IntelliJ - the core fo all JetBrains tools.

Download the archive from the developer.android.com website.

Unpack the archive in your home and run the launcher script from the unpacked bin folder.

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.

Use JetBrains web.

Always download the archive from JetBrains web. The following rules will relieve you of many issues you could otherwise get because of the /opt folder is readonly.

If you are a toolbox user the best you can do is to download the toolbox. Unpack the archive and run the toolbox. You can then download the apps and they will be installed in ~/.local/share/JetBrains folder.

If you are using a single app e.g. PyCharm Community - download the archive and unpack it in your home. Cd into the folder and run the app’s launcher script from the bin folder.

More reading

9 Likes