Problems installing Pycharm - linux

I am trying to install pycharm on my linux OS.
following the instructions pycharm/dowload.
Since I run a linux machine I made sure the pychrarm files in the current directory:
ietX220:~$ ls
Desktop pycharm-community-4.0.1
Documents Music
pycharm-community- 4.0.1.tar.gz
Downloads New Folder Templates
Dropbox octave-workspace Videos
examples.desktop Pictures VirtualBox VMs
jdk1.8.0_25 Public Win7-PV2hh-6c3HY-
QJHM9-8RJJH-P86W8.iso
ietX220:~$ pycharm-*.tar.gz
pycharm-community-4.0.1.tar.gz: command not found
As you can see the pycharm file is in the current(home) directory but is not found.
Then I opened the tar file made pycharm.sh executable:
chmod +x pycharm.sh
And then ran:
~/pycharm-community-4.0.1/bin$ ./pycharm.sh
Startup Error: Application cannot start in headless mode
What am I doing wrong?

I am having the same issue. It looks like maybe you and I both have a minimal (headless) Java install on our systems. Use your system's method for finding installed packages and search for Java, and i'll bet you find only openjdk-headless
yum list installed | grep openjdk
# or on debian-based systems
# dpkg --get-selections | grep openjdk
# =>java-1.7.0-openjdk-headless
Solution then is to install the same package without the "-headless" suffix.
Here's where I am getting my information for the solution: https://bugzilla.redhat.com/show_bug.cgi?id=1177379

I had the same problem and as mentioned before the error was that openjdk was headless. What i did is i installed from the begining openjdk using the command apt-get install default-jdk (for ubuntu). I know it's not the best way to do it, however it is rather quick and simple.

If you have already all the prerequisites (such as Java) installed, try out charmy (PyCharm installer for Linux).
virtualenv charmy-env
source charmy-env/bin/activate
pip install charmy
charmy install
That will install PyCharm into your home directory. It will also simplify your feature PyCharm upgrades. To upgrade you would just have to type
charmy install
instead of downloading distribution manually, unpacking it, etc.
See https://pypi.python.org/pypi/charmy for more.

PYcharm is now available as a snap. Can be easily installed as below
sudo apt update && sudo apt install snapd
Then the community edition can be installed by
sudo snap install pycharm-community --classic
The classic escape is to get snaps that have been published with classic confinements

220:~$ pycharm-*.tar.gz
pycharm-community-4.0.1.tar.gz: command not found
gz files are not executable files. I think the current directory is not in your PATH variable. To get around that you would do "./pycharm-community-3.0.1.tar.gz" and you should see the message "Permission denied" as the gz file would not have execute permission. And if you gave it execute permission it would say "cannot execute binary file: Exec format error".
These are the instructions from the JetBrains website:
Copy the pycharm-*.tar.gz to the desired installation location
(make sure you have rw permissions for that directory)
Unpack the pycharm-*.tar.gz using the following command:
tar xfz pycharm-*.tar.gz
Remove the pycharm-*.tar.gz to save disk space (optional)
Run pycharm.sh from the bin subdirectory
NOTE: PyCharm on Linux doesn't need special installation or running
any installation script. It runs out of the pycharm-*.tar.gz
If you run the command "tar xfz pycharm-*.tar.gz" you should end up with a directory in your current directory named "pycharm-community-4.0.3".
If you cd pycharm-community-4.0.3/bin, "ls -al" should show that pycharm.sh is already executable. Run pycharm.sh and you should be done. The script will prompt for a password at the end so it can put a startup script in a system directory. You must have admin privileges for that part to work. But if you don't, you can still start PyCharm by executing "[path to pycharm directory]/bin/pycharm.sh &" at the command prompt.
I am not sure what the "NOTE:" is saying, but I would ignore it as you get a working PyCharm by doing what it says above the NOTE: .

Setup the newest stable jdk(like jdk1.7 or jdk 1.8) in your system, and set it is the default jdk.
1.download JDK8
2.SET JAVA HOME
sudo gedit /etc/environment
export JAVA_HOME=/home/username/Java/jdk1.8
export JRE_HOME=/home/username/Java/jdk1.8
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
sudo gedit /etc/profile
//before umask xxx adde
export JAVA_HOME=/home/username/Java/jdk1.8
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$JAVA_HOME/bin
3. run pycharm
./pycharm.sh

Related

How can I install a specific version of CMake with WSL on Windows

I installed CMake with the command :
sudo apt-get -y install cmake
But when I tried to Configure a WSL toolchain for my project in clion I have a message saying that my version is not supported.
My version is 3.24.1 and the supported is between 2.8 - 3.20.
Can I have the solution to my problem so I can downgrade the version?
Download the x86_64 .tar.gz package for Linux from the binary distributions section on the download page, e.g. version 3.24.2: ( https://github.com/Kitware/CMake/releases/download/v3.24.2/cmake-3.24.2-linux-x86_64.tar.gz ).
Unpack the archive to a suitable location on the wsl file system. You can make use of the fact that you can access the file system of the Windows host via /mnt/<lowercase drive letter>/....
sudo mkdir /opt
sudo tar xz -f /mnt/c/Users/Joki004/Downloads/cmake-3.24.2-linux-x86_64.tar.gz -C /opt
All you need to do is make sure the cmake command uses the cmake program from the bin directory of the unpacked archive. You could skip this step, if you want to use the path to the binary.
To do this you could add the following line to the end of ~/.bashrc
export PATH=/opt/cmake-3.24.2-linux-x86_64/bin:$PATH
(The line differs depending on the version of CMake you installed.)
echo "export PATH=/opt/$(ls /opt | grep -m 1 cmake)/bin:\$PATH" >> ~/.bashrc
Reopen the WLS terminal or source ~/.bashrc.
. ~/.bashrc
Check, if the process was successful:
cmake --version
Note: There's a good change CLion allows you to specify the path to the cmake executable via settings, so you may want to replace steps 3 to 5 with modifying CLion settings.

uninstall Python3 downloaded from command line tools

I installed python 3.8.2 using xcode command line tools but now according to this article I should remove it to download Miniforge3. I didn't know how to do it so now I encountered this error when I ran command
file $(which python)
architecture error
According to the article and some online sources, it should only show arm64 but mine showed arm64e. When I navigated to condabin folder and try running conda init it crashed.
I think I should remove Python3 and start Miniforge installation process again, but I don't know how to delete it. I tried
sudo rm -rf /usr/bin/python3
but it said: Operation not permitted

Install dotnet core on ec2 linux AMI 2 (c6g)

I am trying to install dotnet-sdk-3.0 on linux AMI 2 ec2 instance (c6g). I am new to linux so tried couple of commands but nothing seems working for me. I tried below.
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
sudo yum install dotnet-sdk-3.1
sudo yum install dotnet-sdk-3.0
When tried above i am getting below error.
[ec2-user#ip-0-0-0-0 console]$ sudo yum install dotnet-sdk-3.0
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00
amzn2extra-docker | 3.0 kB 00:00
amzn2extra-nginx1.12 | 1.3 kB 00:00
packages-microsoft-com-prod | 3.0 kB 00:00
packages-microsoft-com-prod/primary_db | 288 kB 00:00
No package dotnet-sdk-3.0 available.
Error: Nothing to do
Then i tried
mkdir -p "$HOME/dotnet" && tar zxf dotnet-sdk-3.0.100-linux-x64.tar.gz -C "$HOME/dotnet"
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
After this tried the dotnet command but got the error. dotnet: command not found
Finally tried below:
mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-3.1.302-linux-arm64.tar.gz -C $HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
dotnet
dotnet --list-sdk
when i run this, i got below error
[ec2-user#ip-0-0-0-0 home]$ dotnet --list-sdk
Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
at System.Environment.FailFast(System.String)
at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
at System.Globalization.GlobalizationMode..cctor()
at System.Globalization.CultureData.CreateCultureWithInvariantData()
at System.Globalization.CultureData.get_Invariant()
at System.Globalization.CultureInfo..cctor()
at System.String.ToLowerInvariant()
at Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetArch()
at Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment..cctor()
at Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetRuntimeIdentifier()
at Microsoft.DotNet.Cli.MulticoreJitProfilePathCalculator.CalculateProfileRootPath()
at Microsoft.DotNet.Cli.MulticoreJitActivator.StartCliProfileOptimization()
at Microsoft.DotNet.Cli.MulticoreJitActivator.TryActivateMulticoreJit()
at Microsoft.DotNet.Cli.Program.Main(System.String[])
Aborted
also tried to run the dotnet <dotnet-project.dll> and received this error.
Failed to load â–’râ–’), error: /home/ec2-user/dotnet/shared/Microsoft.NETCore.App/3.0.0/libhostpolicy.so: cannot open shared object file: No such file or directory
An error occurred while loading required library libhostpolicy.so from [/home/ec2-user/dotnet/shared/Microsoft.NETCore.App/3.0.0]
[ec2-user#ip-0-0-0-0 console]$
I have followed the microsoft document as well.
https://learn.microsoft.com/en-us/dotnet/core/install/linux-centos
Nothing seems working for me. Can someone please help me here, i am stuck from last 2 days.
Thanks in advance.
PS: I am completely newbie to linux.
I was able to get this to work on Amazon Linux 2 ARM64 with the following steps:
Download and build a recent version of International Components for Unicode. Amazon Linux 2 has version 50 available in the package manager, but dotnet looks for version 55 or later. When Amazon Linux updates this, this step won't be necessary anymore and can be replaced with sudo yum install icu.
Install gcc and python3 because they'll be needed for building libicu. It takes a few minutes to build the library. Amazon Linux 2 recently added libicu60 to the package manager, so you can simply install it with yum:
sudo yum -y install libicu60
Follow the instructions from Microsoft to install the dotnet sdk. Download the dotnet sdk from the Microsoft Website. You may need to download from this link to get the latest version, but the link below worked for me.
cd ~
wget https://download.visualstudio.microsoft.com/download/pr/5ee48114-19bf-4a28-89b6-37cab15ec3f2/f5d1f54ca93ceb8be7d8e37029c8e0f2/dotnet-sdk-3.1.302-linux-arm64.tar.gz
mkdir -p $HOME/dotnet && tar zxf ~/dotnet-sdk-3.1.302-linux-arm64.tar.gz -C $HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
Test that it's working
[ec2-user#ip-172-31-69-243 ~]$ dotnet --list-sdks
3.1.302 [/home/ec2-user/dotnet/sdk]
You are running this on arm64/aarch64. It's a relatively new architecture. It's also incompatible with the Intel 64-bit architecture (x86_64 or x64). So you need to watch out for that.
Installing via RPM
Edit: So, this is just not going to work if you want to use RPM packages.
Quoting https://learn.microsoft.com/en-us/dotnet/core/install/linux-centos:
Package manager installs are only supported on the x64 architecture. Other architectures, such as ARM, must manually install the .NET Core SDK or .NET Core Runtime. For more information, see the manually install section below.
You are using aarch64/arm64. You are not using x64, so this is not going to work.
You need to use the tarball installation method.
Out of date suggestions:
I am trying to install dotnet-sdk-3.0 on linux AMI 2 ec2 instance (c6g).
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
You are running Amazon Linux 2, right? As the URL here says, this is for CentOS 7. It may (or it may not) work on your Linux distribution. Anyway, try it out.
$ sudo yum install dotnet-sdk-3.0
No package dotnet-sdk-3.0 available.
Error: Nothing to do
The error says that it can't find this package. Maybe a package with this name doesn't exist? Maybe you are using the wrong name? Try using yum list to find the correct name:
sudo yum list 'dotnet-sdk*'
It should show you a list of packages, including names like dotnet-sdk-3.0.103. You can install that package by name, then:
sudo yum install dotnet-sdk-3.0.103
If that doesn't work, try another package name from yum list and try installing that.
Installing manually
Then i tried
mkdir -p "$HOME/dotnet" && tar zxf dotnet-sdk-3.0.100-linux-x64.tar.gz -C "$HOME/dotnet"
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
After this tried the dotnet command but got the error. dotnet: command not found
You are running an aarch64 machine. You need to use the arm64 tarball, not the x64 tarball. The x64 tarball is for an Intel processor. It will not work on an ARM processor.
That's surprising. Let me break down what this set of steps is doing:
mkdir -p "$HOME/dotnet" creates a directory named dotnet in your home directory
tar xf ... extracts the dotnet SDK tarball in the dotnet directory you created in step 1
export DOTNET_ROOT=$HOME/dotnet defines an environment variable DOTNET_ROOT. .NET Runtime needs it; I am a bit fuzzy myself on why
export PATH=$PATH:$HOME/dotnet adds the directory you installed the .NET SDK into to the environment variable PATH. PATH is a list of locations that the OS uses to search for a command that you enter. For example, when you type dotnet in the command line it searches for dotnet executable (think dotnet.exe on Windows) in this list of directories.
So let's try and debug it one by one:
Does the directory dotnet exist in your main home directory (aka $HOME)? Can you cd ~/dotnet? Does that work?
After you extract the tarball, do you see a file named dotnet in the dotnet directory in your $HOME? Does ls $HOME/dotnet/dotnet work? What does it show you?
What does echo $PATH show you? Does it include that dotnet directory in the value?
If you run which dotnet, does it find the dotnet executable in your main $HOME directory?
Running the SDK
when i run this, i got below error
[ec2-user#ip-0-0-0-0 home]$ dotnet --list-sdk
Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support
The error includes this phrase: Couldn't find a valid ICU package installed on the system.
It really means that. You need to install the ICU package for your Linux distribution:
sudo yum install libicu
And then try running dotnet --list-sdk again.
Error Running dll
Failed to load â–’râ–’), error: /home/ec2-user/dotnet/shared/Microsoft.NETCore.App/3.0.0/libhostpolicy.so: cannot open shared object file: No such file or directory
An error occurred while loading required library libhostpolicy.so from [/home/ec2-user/dotnet/shared/Microsoft.NETCore.App/3.0.0]
This is strange. It says it can't find a file that should be part of the .NET Core installation.
What does dotnet --list-runtimes say? Does it show the 3.0.0 runtime installed? If not, that means your installation is messed up. You should probably install .NET Core 3.0 again. (Or better yet, install 3.1 because 3.0 has been end-of-life'd).
Does the file /home/ec2-user/dotnet/shared/Microsoft.NETCore.App/3.0.0/libhostpolicy.so exist? If it doesn't it's the same problem as above: your installation is messed up.
What does file /home/ec2-user/dotnet/shared/Microsoft.NETCore.App/3.0.0/libhostpolicy.so say? Is it an ELF 64-bit LSB shared object?
The output is: ELF 64-bit LSB shared object, x86-64
This is a x86-64 file! In other words, you have (somehow) installed an linux-x64 (Intel 64-bit architecture) runtime. Not too surprisingly, it doens't work on the ARM 64 bit architecture. You need to delete this and re-install the SDK. I suggest just blowing away your current installation (rm -rf $HOME/dotnet) and install the linux-arm64 SDK again.

google-cloud-sdk installation not finding right Python 2.7 version in CentOS /usr/local/bin

Our server OS is CentOS 6.8, I was trying to install google-cloud-sdk, even though I installed
python 2.7 in /usr/local/bin
, it is still looking at old version of
python 2.6 in /usr/bin
. I tried giving export PATH=/usr/local/bin:$PATH to first look at /usr/local/bin than /usr/bin but still the problem persists. please suggest a way to fix.
The way I have solved this (and I know it works) is to first install Python 2.7 in whatever way you'd like, then install pip using Python 2.7 which will give you pip2.7. You can then use pip2.7 to install the google_compute_engine module so that it ends up in the right modules folder.
# get pip2.7
wget https://bootstrap.pypa.io/get-pip.py
python2.7 get-pip.py
# install the gcloud module
pip2.7 install google_compute_engine
You can then add this to your $HOME/.bashrc
export CLOUDSDK_PYTHON=/usr/local/bin/python2.7
This is the best repeatable way I know of
Go to the google-cloud-sdk folder and open the install.sh file.
Change the CLOUDSDK_PYTHON="python" value to CLOUDSDK_PYTHON="python2.7"
Rerun the install with the command:
./install.sh
Or you could install it using yum:
https://cloud.google.com/sdk/downloads#yum
If you are on Windows This is a simple solution that worked for me:
open Powershell as administrator and run this to add your Python folder to your environment's PATH:
$env:Path += ";C:\python27_x64\"
Then re-run the command that gave you the original error. It should work fine.
Alternatively you could run that original (error-causing) command within the Cloud SDK Shell. That also worked for me.
I found a CLOUDSDK_PYTHON inside my ~/.bash_profile (or ~/.zshenv).
I removed it, and went back into my google-cloud-sdk directory and reinstalled it.
./install.sh
This fixed the issue for me.

How to install packages in Linux (CentOS) without root user with automatic dependency handling?

Is it possible to use RPM or YUM or any other package manager in Linux, specifically CentOS, to install a package either already downloaded or from repo to a custom location without admin/root access?
I tried building from sources, using cmake, configure, make, make install etc, but, it ended up having so many dependencies one after other.
Or are there any better alternatives?
It is possible to use yum and rpm to install any package in the repository of the distribution. Here is the recipe:
Find the package name
Use yum search.
Download
Download the package and all of its dependencies using yumdownloader (which is available on CentOS by default). You'll need to pass it --resolve to get dependency resolution. yumdownloader downloads to the current directory unless you specify a --destdir.
mkdir -p ~/rpm
yumdownloader --destdir ~/rpm --resolve vim-common
Choose a prefix location
It might be ~, ~/centos, or ~/y. If your home is slow because it is on a network file system, you can put it in /var/tmp/....
mkdir ~/centos
Extract all .rpm packages
Extract all .rpm packages to your chosen prefix location.
cd ~/centos && rpm2cpio ~/rpm/x.rpm | cpio -id
rpm2cpio outputs the .rpm file as a .cpio archive on stdout.
cpio reads it from from stdin
-i means extract (to the current directory)
-d means create missing directory
You can optionally use -v: verbose
Configure the environment
You will need to configure the environment variable PATH and LD_LIBRARY_PATH for the installed packages to work correctly. Here is the corresponding sample from my ~/.bashrc:
export PATH="$HOME/centos/usr/sbin:$HOME/centos/usr/bin:$HOME/centos/bin:$PATH"
export MANPATH="$HOME/centos/usr/share/man:$MANPATH"
L='/lib:/lib64:/usr/lib:/usr/lib64'
export LD_LIBRARY_PATH="$HOME/centos/usr/lib:$HOME/centos/usr/lib64:$L"
Edited note (thanks to #AmitNaidu for pointing out my mistake):
According to bash documentation about startup files, when connecting to a server via ssh, only .bashrc is sourced:
Invoked by remote shell daemon
Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by the remote shell daemon, usually rshd, or the secure shell daemon sshd. If Bash determines it is being run in this fashion, it reads and executes commands from ~/.bashrc, if that file exists and is readable.
Now if you want to install a lot of packages that way, you might want to automate the process. If so, have a look at this repository.
Extra note: if you are trying to install any of gcc, zlib, make, cmake, git, fish, zsh or tmux , you should really consider using conda, see my other answer.
TL;DR Use Miniconda, conda-forge is amazing.
curl "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" | sh
Or, alternatively:
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > Miniconda.sh
bash Miniconda.sh -b -p ~/conda
# -b is used to specify that this is done "in batch", so skip the EULA prompt
# -p lets you specify where you want conda installed
Commonly wanted packages:
gcc conda install gcc
zlib conda install zlib
make conda install make
cmake conda install cmake
git conda install git
fish conda install -c conda-forge fish
zsh conda install -c ActivisionGameScience zsh
tmux conda install -c conda-forge tmux
This tmux has a bug with the name of the ncurse library it uses. You can work around it by going to your da/lib folder and symlinking ln -sT libtinfow.so.6.1 libtinfo.so.6
For the rest, you can try https://anaconda.org/search?q=.
I've tried for a long time to get a package manager to work well on CentOS/RedHat but without success. The best I could do was to install a Gentoo Prefix at the correct location on another CentOS with root access, then scp a .tar.xz of the whole installation to the target server (only way to get a proper gcc for Gentoo Prefix). I could emerge (build & install) packages on the target server but kept hitting problems with locals and permissions.
I recently achieved a user installation of some interesting packages using conda. Here is how to install it from the command line:
curl "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" | sh
If like me, your home folder is hosted on a remote drive (a network file system), you might not want to install it in your home folder, so you might want to use something like mkdir /var/tmp/lo then specify an installation folder like /var/tmp/lo/da during the installation.
You'll then be able to install quite a lot of packages, though maybe not all those you wanted. Most of the time, if it is not in the default channel, it will be in conda-forge. You can check for existing packages at https://anaconda.org/search?q=
Other package managers I've tried to use after conda:
Linuxbrew
I thought that with that it would be easy to install homebrew (linuxbrew) but their sources are messy and use hard-coded absolute path to ruby interpreter, which fails because it isn't the last version and so on and so on and I gave up.
Nix
Nix still requires you to use the /nix folder. They hard-coded it too and it's hard to sed it correctly from every download it has to do during the installation (let alone updates).
Gentoo Prefix
I expect Gentoo Prefix to be easier to install directly now that we gcc can be used on the target server. -- Ok, I tried but met permissions bugs during installation (2018-09-28):
portage.exception.OperationNotPermitted: chown(b'~/gentoo/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.12/image/var', 2000, 2000)
PkgSrc
I'm going to try pkgsrc now. -- Use (older) version 64-bit EL 6.x if on CentOS 6 or if encountering (G)LibC version issues with the 7.x one. -- No luck, pkgsrc hard codes /usr/pkg/sbin and /usr/pkg/bin. So it can't be used as user, unless maybe setting up a fakechroot environment. But I've never done that and I expect usability issues.
Please comment/answer if you succeed in installing any other package manager.
Download the packages, and indicate to include dependencies with the --resolve flag.
yumdownloader --resolve openslide-tools
Iterate over all downloaded rpm files.
for i in *.rpm; do rpm2cpio $i | cpio -idv; done
the output will be stored in your present working directory $PWD/usr/*
This answer by goldilocks sounds like what you are looking for.
https://unix.stackexchange.com/a/61295
It's still not a pretty process, but seems easier than building from source.
Otherwise you might want to look into non-root package managers as an alternative to yum.
Yes it is. If the software is packaged in repos. And admin installed
PackageKit-command-not-found package.
See:
https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound

Resources