Ubuntu – How to update PyCharm 3.4 to 4 in Ubuntu 14.04

idepythonsoftware installation

I have Pycharm 3.4 community edition installed. I want to update my installation to 4.0.

Going to Help ⇒ Check for update shows me that I am in latest version which is 3.4.1.

Manual download and installation creates 2 separate installations of Pycharm; one new and one previous installation.

Best Answer

I recently updated from 4.0.1 to 4.0.4, which I had installed in /usr/local/bin/ (I'm new to Linux, so I'm not sure if this is the best location). Essentially I moved the tarball there, unpacked it, deleted the old directory, realized the script was still pointed at the old (now nonexistent) version, and edited the script to point at the new version. It went like this (adapted from official installation instructions):

sudo mv ~/Downloads/pycharm-community-4.0.4.tar.gz /usr/local/bin/
cd /usr/local/bin/
tar xfz pycharm-community-4.0.4.tar.gz
sudo rm pycharm-community-4.0.4.tar.gz
sudo rm -r pycharm-community-4.0.1
cd pycharm-community-4.0.4/bin/
sudo bash pycharm.sh

PyCharm launched, so I assumed I was good. I then tried to launch PyCharm as I usually would, and got the following error:

Traceback (most recent call last):
  File "/usr/local/bin/charm", line 96, in <module>
    os.execv(RUN_PATH, [bin_file] + args)
OSError: [Errno 2] No such file or directory

Oops; I assumed the charm script to which the PATH points (in /usr/local/bin/) would be updated by the bash pycharm.sh line; I was wrong. No worries, it's easy enough to do yourself.

cd /usr/local/bin/
sudo nano charm

The first line after the import statements defines the RUN_PATH; you'll want to change this to point to the new directory (i.e., 4.0.1 to 4.0.4 for me). Once I did that, it worked like a charm.

My guess is that if I had removed this file before running the script in the new version's bin folder, it would've created a new script from scratch. This is probably a better practice, as the script itself may be changed more meaningfully than the RUN_PATH definition.

TL;DR: You'll need to delete the old directory and launch script, unpack the new directory, and run the launch script from inside the unpacked directory.

sudo mv ~/Downloads/pycharm-community-4.0.4.tar.gz path/to/install/
cd path/to/install/
tar xfz pycharm-community-4.0.4.tar.gz
sudo rm pycharm-community-4.0.4.tar.gz
sudo rm -r pycharm-community-<old version>
sudo rm charm
cd pycharm-community-4.0.4/bin/
sudo bash pycharm.sh
Related Question