PyCharm Requires Login When Ran as Root - linux

The code inspection is not working properly on my Pop!_OS 21.04 x86_64, so I checked updates and realized that my PyCharm is actually out of date, but to update it I need to run PyCharm as root.
But, when I go to where PyCharm is located and run sudo ./pycharm.sh, It's like it is a fresh install and wants me to login.
I have come across this issue in other apps too, where if I run it as root, it uses a different directory for config etc.
How do I get around this? Thanks in advance.

Related

django-admin command can't be run because files are not in the right place

So I thought I installed anaconda and Django correctly but I guess I didn't because my django-admin commands don't work. As you can see here, I have the file paths for a couple Django files all screwed up:
/Users/user/anaconda3/bin/django-admin
/Users/user/anaconda3/bin/django-admin.py
/Users/user/anaconda3/lib/python3.8/site-packages/Django-3.1.5.dist-info/*
/Users/user/anaconda3/lib/python3.8/site-packages/django/*
This makes it so I can't run any django-admin commands that I need to run to start a new project in PyCharm.
You can try change the project structure in Pycharm settings
I found the issue--make sure that you install djangorestframework inside the virtual environment you are working in, not the base one.

How to start anaconda-navigator with root Privileges ? (Linux)

After starting "anaconda-navigator" with a terminal, it ends up with dialogue box prompting that " it can't be run with root privileges.anaconda-navigator startup error as root.
For anaconda-3 run:
source ~/anaconda3/bin/activate root
anaconda-navigator
Hopefully this will solve everything.
I have exactly the same issue that you have and after trying the shocking solutions provided i ended up with more errors as you can find in some of my comments there.
How to Fix this:
The dialogue box as you and I see it, is a common dialogue in the Linux world, it has only one reason and that is your GUI is logged with a "normal user" but somehow you managed to install the anaconda with superuser(root).
so if possible, head to your login section and login with root user + with GUI activated(only saying this because there's a big Linux world out there)
if this didn't help, re-install it but be careful when uninstalling it as python can mess a lot of things up(its an OS bomb actually).
How to prevent this:
1- do not allow Anaconda installation to use any superuser areas like /root
2- try to install it with normal user and with sudo command
Good luck (the thing we all need with python installers)
The installation process should be done with the regular user but no root. In my case, the problem appears when I installed with superuser session. I follow these instructions, installing just with my username (without sudo privileges) and the problem was solved.
In /home/user/anaconda3/lib/python3.7/site-packages/anaconda_navigator/app/start.py:
if (MAC or LINUX) and os.environ.get('SUDO_UID', None) is not None:

Spyder external system terminal does not work (Python3.6)

I am not sure if this is a right place to ask this type of questions. I am a python beginner or programmer overall at this point. I am using Spyder to use python 3.6 (via Anaconda). I wrote a code that works fine when I run it in the current Ipython console. But I really need to run it in an external system terminal. In order to do so, I chose the following path: Run-> configuration per file -> execute in an external system terminal. That has been working fine. But now it refuses to work!
I validated that there is nothing wrong with my code by running something simple and saw that running via external system terminal does not work.
So far I deleted Anaconda and re-installed it. Could someone suggest what I should be looking for to diagnose the problem and fix it?
Thanks!
I had the same problem and noticed that unless the Working directory settings is set to "The directory of the file being executed", it won't work.
You can change it in "Run" > "Run configuration per file".

Using sudo atom no longer opens Atom at all, let alone as root

I'm using the Atom editor. Yesterday, if I typed:
sudo atom . it opened the current directory as root
sudo atom it opened Atom with whatever I last had open as root
Today if I run either of those commands nothing happens. The editor doesn't open and there are no error messages.
These terminal commands worked yesterday on these exact same files, today they do not.
How can I fix this?
Why is this happening?
If I have not provided enough information it's because I don't know what info one would need to have a fuller explanation of my circumstance. Let me know what I should add I'll happily edit this question to provide it.
Atom : 1.13.0
Electron: 1.3.13
Chrome : 52.0.2743.82
Node : 6.5.0
Ubuntu 14.04 LTS
Elementary OS Freya (64-bit)
After updating Atom text editor it seems I require to run --no-sandbox flag but after a while it becomes boring so I wrote a simple BASH script to be doing this for me:
eval "atom --no-sandbox flag"
just save this in a common directory that you frequently use and type ./atom_text_editor.sh in the terminal to deploy(Depending on the name you choose for your script)
A recommendation, when working on linux avoid using sudo or su instrucctions, they are intended to execute privileged instructions like system configurations. It might be related to permissions, execute ls -al and verify that the owner/group of yor files is root, if not, then check if "others" have read permission, if not, then thats is the problem.
Be aware running atom with sudo is not recommended.
I've had this problem for a few days, I installed atom using snap (on ubuntu 18.04) a few weeks ago, back then it worked perfectly, but the last few days if i ran 'sudo atom' nothing would happen at all, reinstalled it using snap, still didn't work, removed settings, still didn't work.
I ended up installing atom using the apt packagage manager and now it works. I used this guide: https://codeforgeek.com/install-atom-editor-ubuntu-14-04/
Furthermore when running atom with sudo it should be ran with the --no-sandbox flag.
Conclusion: seems to be a problem with atom when installed using snap.

PhpStorm update on Ubuntu/Mint

I am running PhpStorm on Linux Mint installed in /opt. PhpStorm is notifying me that there is an update available (8.0.3), but then it tells me it doesn't have write permission to apply the update, and that I should run it as a privileged user to update it.
If I run phpstorm.sh as root/sudo it asks for license info and looks as though it's running the installer rather than the program. PhpStorm is licensed when I run it from the desktop.
So how can I run updates?
I had the same issue and was able to change ownership of the PhpStorm folder to get it to work. Assuming your username is newownername and PhpStorm installation is located in /opt/phpstorm, the command should look like this:
chown -R newownername /opt/phpstorm
Note that you should change username and path to appropriate values.
No need (and not recommended) to change the ownership or the permissions of the opt/phpstorm directory. In fact, the error message returned says exactly what you should do: run it as a privileged user to update it.
After exiting PHPStorm, you can run it as a privileged user using the following instructions
sudo updatedb && sudo locate phpstorm.sh
sudo /path/to/phpstorm.sh
The first instruction updates the locate database and returns the location of the phpstorm executable in your computer.
Use the returned location as the path in the second instruction.
When starting PHPStorm as root, it will start with the default settings. It might even ask you if you want to apply your license... No need to change any of this: the default settings and running PHPStorm in evaluation mode will work just fine. After it starts, check for updates in the menu Help and apply them normally. PHPStorm might restart once again as root. Just close it once more and restart normally. When restarting as your user, you'll be given the ability to select your normal settings (usually stored in your user's directory: the path will be suggested). Accept and continue. PHPStorm will start with all your preferences and settings restored and properly upgraded.
If plugin updates are required, you can update them normally. No need to do it using root.
This solution is recommended by JetBrains. Changing the ownership or the permissions of the opt/phpstorm directory is not recommended and in fact pointed as incorrect by Jet Brains, as you can verify on their answer regarding the process of upgrading a similar product: Fixed: PyCharm automatic update fails on Linux due to permissions.
sudo chown -R $USER:$USER /opt/PhpStorm* , worked for me.
JetBrains are publishing their entire IDE portfolio as snaps, including PHPStorm. Snaps work on all supported versions of Ubuntu, including 14.04 and on Linux Mint 17.x and 18.x.
Some of the advantages of the JetBrains snaps are that they are always up to date, will automatically stay updated and are very easy to install.
To install PHPStorm in Ubuntu or Linux Mint:
sudo apt install snapd
sudo snap install phpstorm --classic

Resources