New answers tagged

0

If you are using Anaconda3, add the following to the very end of your /root/.bashrc file: export PATH="/root/anaconda3/bin:$PATH" As far as Anaconda path goes, that export is all you need to know. Anaconda uses hard links.


0

The issue was that I had to versions of pip: - one installed using sudo apt-get python-pip - one installed using pip install -U pip setuptools Appearently snapcraft doesn't know from where to copy it when second command is used to install another version of pip.


0

Replace your subprocess.run() command with this: subprocess.call(self.items, stdout=DEVNULL, stderr=DEVNULL,shell=True) This should work, however, I'd personally approach this via using lists, and call specific shell per each shell script. shell=True however will call /bin/sh on your bootstrap.sh , which hopefully doesn't contain any bashisms and is ...


3

Both sudo pip install and its other common variant sudo -H pip install should not be encouraged because it is a security risk to use root privileges to use pip to install Python packages from PyPI (Python Package Index). From http://stackoverflow.com/a/21056000/486919 (emphasis mine): When you run pip with sudo, you run setup.py with sudo. In other ...


1

No, this is correct. I cannot validate this claim. I always use sudo -H with pip. pip can only damage operating system files as much as apt. Only do not use sudo with pip when you want to install only for that user.


2

As you can see from http://packages.ubuntu.com/search?keywords=python3.4&searchon=names&suite=xenial&section=all, there is no package for python3.4 for Ubuntu 16.04. You can compile and install Python 3.4 from source, but if you are not familiar with doing it or prefer to install packages using the APT package manager, I would recommend ...


0

Yes, a binary search will generally be faster. No, the standard library index function has no option for that. Another answer has code for a binary search: from bisect import bisect_left def binary_search(a, x, lo=0, hi=None): # can't use a to specify default for hi hi = hi if hi is not None else len(a) # hi defaults to len(a) pos = ...


1

Setting (setq python-shell-interpreter "python3") in .emacs should be enough


6

The system's default version is the one pointed to by the symlink /usr/bin/python. In 16.04 this should be python2.7 but you have changed it (as you discovered, this is a bad idea as many programs in Ubuntu use Python and will not work if they find the wrong version), and it is pointing to /usr/bin/python3 which is a symlink pointing to /usr/bin/python3.5 ...


2

Use os.chdir() instead. Apart from the issues, mentioned in the existing answers, I wouldn't prefer using shell=True, nor subprocess.call() here to change directory. Python has its own way of changing directory in os.chdir() (don't forget to import os). ~ ("home") can be defined in several ways, a.o. os.environ["HOME"]. Reasons to prefer that over shell=...


0

You can install pip for Python 2 by running: sudo apt-get install python-pip


4

By default subprocess.call doesn't use a shell to run our commands you so can't shell commands like cd. To use a shell to run your commands use shell=True as parameter. In that case it is recommended to pass your commands as a single string rather than as a list. And as it's run by a shell you can use ~/ in your path, too: subprocess.call("(cd ~/catkin_ws/...


4

subprocess.call() expects a list, with first item obviously being a legitimate shell command. Compare this for instance: >>> subprocess.call(['echo hello']) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/subprocess.py", line 523, in call return Popen(*popenargs, **kwargs).wait() ...


0

I don't know where it came from, but I had a python binary in /usr/local/bin that was overriding my default one. It was build with an older gcc and that was causing the problem.


0

Follow these steps and normally after that it should be fixed. 1. Backup dpkg status file. sudo cp /var/lib/dpkg/status status.bkp 2. edit the dpkg status file sudo nano /var/lib/dpkg/status Search for the package name that appears in the error (you can use the search function by pressing CTRL+W and typing python-pip) DELETE the section that is ...


1

Run the follwing: as mentioned above, you need to apt-get install python-django or python3-django sudo apt-get install python-pip (or sudo apt-get install python3-pip) sudo apt-get install mysql-server (I would suggest you do not use sqlite3 if you want to work with databases) (THIS STEP IS OPTIONAL!!!!) sudo apt-get install apache2 (for django to run on ...


0

Well something must have went wrong during that pip3 install. You can also Django like sudo apt-get install python3-django Cheers [if this helps]


9

I posted this a while ago on a (now) deleted Q/A. Maybe it is useful to you. A patch to allow (very) long messages The "patch" below will allow you to have notifications as long as it takes on your desktop: In case of (very) long notifications, instead of this: you will see this: The duration of the message is automatically set to the length of ...


0

After many hours of searching, tweaking and all other kind of things I have found a solution to this problem All the below steps are done without rebooting First I removed all the four broken packages using synaptic programme manager(mark as removal). Then I updated my system using these commands sudo apt-get update sudo apt-get -f upgrade sudo apt-get -...


4

As I've noted in the comments , notify-osd is not very suitable for extensive messages and one should prefer zenity instead. Simple example of usage would be spawning zenity dialog via subprocess.call([COMMAND,OPTIONS]) import subprocess text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore ...


1

The principle behind the www-data user is that it is an unprivileged user. When you run a daemon (background program like a web server), for security purposes it is good for it to drop privileges after starting, so that it spends the rest of its time with the lowest privileges possible. In the past the nobody account was often used for this purpose. The ...


2

Under no circumstances permit your web server to run commands with sudo. Not even hyper-specific commands. This is a huge security risk. A web server should not be given permissions to access sudo commands, which then permit root access for commands. Especially when given nopasswd form of sudo, should your web server be breached, any command run by a ...


4

If you are not opposing bash solutions, here's a script that does what you outlined. It can be added to /etc/rc.local to run on every boot. Just call it like bash /path/to/script & from within /etc/rc.local #!/bin/bash while true do screen ./run.sh arg1 arg2 "arg3" & # start in background CMDPID=$! # get pid of that command TIME=$( date ...


2

Suppose we run some kind of python script via python stuff.py. We can easily find it's PID via pgrep $ pgrep -f stuff.py 7573 And kill with pkill in a similar fashion. $ pkill -f stuff.py If you want to kill only the child process, and not script itself, then we ...


0

It looks like it is complaining about stuff that should be installed. Actually, you should not have to "download" anything as all of this stuff is available through apt-get. Run the following commands to install all needed software and drivers: sudo apt-get update sudo apt-get install hplip hplip-data hplip-doc hpijs-ppds hplip-gui hplip-dbg printer-...


0

From the same directory: sudo make uninstall sudo apt-get install --reinstall python Then, close your terminal to refresh bash or run the following command: . ~/.bashrc Also, close any open terminals or run the last command specified in each running terminal to refresh each running terminal.


3

The differences might seem subtle in actual usage, but: libappindicator1 is bound via GTK2 libappindicator3-1 is bound via GTK3. There may be deeper stuff that you can look into but that should get you pointed in the right direction. Nothing to do with the version of Python. All the heavy lifting is done through GObject introspection. Oh there does seem ...


6

~/ is a shell abbreviation for your home folder, usually /home/USERNAME/, where USERNAME is the name of your user. It's the same as $HOME ~/.local/bin is a subfolder named bin in the subfolder named .local in your home folder. You can use ~/.local/bin/pip3 to call your new pip3 executable. It may be easier to add ~/.local/bin to the $PATH environment ...


0

If you want to have periodic check, say on every restart or every Tuesday of the month, you could set up a cron job, that calls your backup script, and you could check the filesystem usage within your backup script itself. Can be done simply like so: if [ $(df / --output=pcent | awk -F '%' 'NR==2{print $1}') -ge 80 ] ; then # do something here fi ...


2

No, python -v has not changed anything or done any harm. Upon initialization, It will show you the modules that are being initialized and the respective files from which they are being loaded. Upon exit, it will show you the unloading information of the loaded modules. So, for understanding, you can take -v as verbose. On the other hand, to get the version,...


1

When not sure of commands best to check man in terminal. Most packages have a man command man python -v Print a message each time a module is initialized, showing the place (filename or built-in module) from which it is loaded. When given twice, print a message for each file that is checked for when searching ...


1

To avoid cron, you could also call your script in an infinite loop with a delay of 10 minutes. If you want to launch the script again 10 minutes after the previous instance exited, use this: while true ; do /PATH/TO/SCRIPT.PY ; sleep 10m ; done However, if you want to launch the script every 10 minutes on the clock, no matter how long the last instance ...


3

Make the script executable by: chmod u+x /path/to/script.py Note that, you need a shebang (i.e. indicate interpreter in the first line of the script), for python2: #!/usr/bin/env python2 For python3: #!/usr/bin/env python3 Open your cron table by crontab -e Add the following cron entry: */10 * * * * /path/to/script.py Note that, if the ...


1

for Ubuntu 16.04 and newer The Quickly application recommended in the accepted answer is not available in the default Ubuntu 16.04 repositories. An alternative software to Quickly is Illumination Software Creator. Version 6 of this software (the latest version) is released as a Debian package under a GPLv2 license. Illumination Software Creator allows you ...


1

The cause of the problem is that the shebang of the runanki script at https://github.com/dae/anki/blob/master/runanki explicitly states Python 3, so ./runanki invokes the Python 3 interpreter but you had installed pyaudio for Python 2. As a result, Python 3 is not able to find pyaudio and therefore raises an ImportError. The easiest solution here is to ...


3

The issue is that when you install things with sudo apt-get install (or sudo pip install), they install to places in /usr, but the python you compiled from source got installed in /usr/local. The python you actually end up running when you type python at the prompt is the one you compiled (based on the output of the python -c 'import sys; print(sys.path)' ...


0

I think your Cron service not started. Try: service crond start You can check Cron service status with: service crond status Make sure your script file has execute permission.


0

From the comments, it looks like you were trying to use pip3 inside a virtualenv that is set up for Python 2. Note that running virtualenv venv creates a virtualenv named venv for Python 2 by default on Ubuntu if you don't specify the Python version explicitly. In any case, if you want to create a virtualenv for Python 2, run: virtualenv venv # create ...


0

» I need to install some packages with python 3.3 (lxml, ftplib, etc...) and for that I need pip « Then please do dpkg -L python3-pip to know that the python3-pip is /usr/bin/pip3 Installing with pip3 : pip3 install [package]


0

So I finally fixed the problem. I had to install the latest nvidia drivers (367) and disable safe boot in UEFI. Suddenly it is working.


0

SharpDevelop SharpDevelop is for developing application based on .Net Framework. It does support IronPython and has GUI designer for WinForm, Silverlight, WPF Application. While Visual Studio also has various GUI designer for IronPython, however it doesn't have GUI for WinForm.


0

As another method for running pylint on both Python 2 and 3, note that you can use Python's -m switch to run a module installed on the system in the current version of Python, so you can do $ python2 -m pylint $ python3 -m pylint to explicitly select which one you want. You could make these into aliases or shell scripts if you wanted.


0

As @eyoung suggested, use sudo apt-get install python-setuptools, it should do the trick.


0

I'm assuming you are using the USE team's MAAS client, from https://github.com/Ubuntu-Solutions-Engineering/maasclient. That client returns data from queries in BSON format. To parse BSON output, use the Python BSON package: https://github.com/py-bson/bson Here's how you'd read the data in your case: import bson resp = self.client.get(u"nodes/%s/" % ...


1

Ubuntu depends on /usr/bin/python being Python2. If you change this to Python3 you break the system. Change it back to Python2. See Why isn't python 3 the default python binary? and How do I make the terminal run python 3.1? for more about this.


0

Normally you should not set LC_ALL persistently as a global environment variable. If you do that on a desktop, you make the GUIs for setting languages/locales useless. As regards your Python program, you need this line: locale.setlocale(locale.LC_ALL, '') It makes the locale, i.e. the output of the locale command, effective within the Python program.


1

This is a known bug and is being worked on , add your self to the affected users list on this page https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1581679


0

I had the same error message. What worked was sudo dpkg -a --configure as described in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=709157.


0

Sometimes the dependencies that need fixing are unrelated to the program you are trying to install. In my case it was giving off this error: The following have unmet dependecies shashlik : Depends: libc6-i386 but it is not going to be installed Depends: lib32gcc1 but it is not going to be installed Depends: lib32z1 but it is not going to ...


3

Install pip for Python 2 by running sudo apt install python-pip # pip for Python 2 and for Python 3 by running sudo apt install python3-pip # pip for Python 3 I would discourage you from using easy_install at all if possible; to learn more, see the many great answers at http://stackoverflow.com/q/3220404/486919. Also note that the installation ...



Top 50 recent answers are included