I run this command:
apt-get install python-box2d
and I get the following output:
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Always prefix sudo before executing any installation related command no matter if it's pip or aptik, it tells the terminal that you have the authority to make this change (installation).
For example:
sudo apt-get update
It's for updating your repository , and so it needs to be authorized to get executed.
Also sometimes this error occurs when some other installation is in progress and it has locked the main directory , So you just have to wait for that process or installation to get completed.
Related
I am trying to install python pip on HDP2.6.5, but its constantly failing with Error 403.
[root#sandbox-hdp ~]# yum install python-pip
Loaded plugins: fastestmirror, ovl
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/repodata/repomd.xml: [Errno 14] HTTP Error 403 - Forbidden
Trying other mirror.
To address this issue please refer to the below wiki article
https://wiki.centos.org/yum-errors
If above article doesn't help to resolve this issue please use https://bugs.centos.org/.
One of the configured repositories failed (HDP-2.6-repo-1),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=HDP-2.6-repo-1 ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable HDP-2.6-repo-1
or
subscription-manager repos --disable=HDP-2.6-repo-1
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=HDP-2.6-repo-1.skip_if_unavailable=true
failure: repodata/repomd.xml from HDP-2.6-repo-1: [Errno 256] No more mirrors to try.
http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.5.0/repodata/repomd.xml: [Errno 14] HTTP Error 403 - Forbidden
Hortonworks repos have been behind a pay wall for the last few years, so installing or upgrading of packages within the sandbox will no longer work.
I got a new Raspberry Pi, installed Ubuntu on it, wrote a python script but when I run the script using python3 script.py it just cant find libraries that I installed using pip3 and give library missing erros.
But if I run the same script using sudo python script.py it runs.
I have given script.py permission using sudo chmod 777 script.py , yet same issue
I even gave folder permissions sudo chown user user /home/someuser/Desktop , yet same problem
Now the bigger problem is when I use basic IDE like Thonny , I cant run using sudo from the IDE itself , so I have to run the script from terminal separately which is such a pain
Here is my file permissions
-rwxrwxrwx 1 someuser someuser 2528 Dec 19 17:57 script.py
Here is my folder permissions
drwxr-xr-x 3 someuser someuser 4096 Dec 19 17:56 Desktop
There is no other user on the system except for the one I created during ubuntu setup
I have mostly installed all libraries using sudo pip3 install
One of the error I am getting while trying to use GPIO library
File "/home/someuser/Desktop/beep.py", line 11, in <module>
GPIO.setup(18, GPIO.OUT)
RuntimeError: Not running on a RPi!
Another error:
File "/usr/lib/python3.8/socket.py", line 231, in __init__
_socket.socket.__init__(self, family, type, proto, fileno)
PermissionError: [Errno 1] Operation not permitted
Is there a way where I dont have to use sudo every time and makes life easy and easily work with installed libraries.
Here is some additional info
/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/home/someuser/.local/lib/python3.8/site-packages
/usr/local/lib/python3.8/dist-packages
/usr/lib/python3/dist-packages
someuser#pi4:~$ which python3
/usr/bin/python3
did you use sudo to install libraries, if so you, thats why its not available for your current user.
install packages with pip install --user <package_name> to install them for current user.
or
use a virtualenv
sudo apt-get update && sudo apt-get install scrapyd
Err:7 http://archive.scrapy.org/ubuntu precise InRelease
Could not connect to archive.scrapy.org:80 (31.125.20.14), connection timed out
Err:8 http://archive.scrapy.org/ubuntu scrapy InRelease
Unable to connect to archive.scrapy.org:http:
Reading package lists... Done
N: Ignoring file 'scrapy.listecho' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
W: Failed to fetch http://archive.scrapy.org/ubuntu/dists/precise/InRelease Could not connect to archive.scrapy.org:80 (31.125.20.14), connection timed out
W: Failed to fetch http://archive.scrapy.org/ubuntu/dists/scrapy/InRelease Unable to connect to archive.scrapy.org:http:
W: Some index files failed to download. They have been ignored, or old ones used instead.
enter code here
I installed scrapy without any error, now I want to install scrapyd but it gives this error
I checked Can't install Scrapyd on EC2,but no answer was there
I am trying to use Tika in python to extract text from the pdf files. I have Java 8 installed on my system. Despite that, I am unable to convert these pdf's into text file. Below is the code that I am using:
file_name = file.split('\\')[-1]
path = "C:/Users/user_name/PDF_Files/"+file_name
raw = parser.from_file(path)
name = path.split('/')[-1][:-4]
print(name)
file_name = "C:/Users/user_name/PDF_Files/"+name+".txt"
text_file = open(file_name,"w",encoding="utf-8")
if raw['content'] is not None:
text_file = open(file_name,"w",encoding="utf-8")
text_file.write(raw['content'])
text_file.close()
for file in glob.glob("C:/Users/user_name/PDF_Files/*.pdf"):
gettext(file)
Below is the error message that I am getting after running the above code:
Error Message
2019-11-07 15:09:06,062 [MainThread ] [ERROR] Unable to run java; is it installed?
2019-11-07 15:09:06,062 [MainThread ] [ERROR] Failed to receive startup confirmation from startServer.
Faced the same issue, After some trial, I resolved the issue as
For ubuntu,In the terminal
java --version
1.Path not correct -> configure it.
2.Old java version -> update it.
3. Java not available -> install it
I followed below for installation
sudo apt update
sudo apt install default-jdk # Confirm the installation by typing y (yes) and press Enter.
sudo apt update
sudo apt install default-jre
sudo apt install software-properties-common
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java11-installer
Finally check again,
java --version
Now head on to check tika again!!
This problem occur after I try to use the script to install Maya 2014 and because I failed with some libraries, I used synaptic package manager to completely remove Maya and I used
sudo rm -r /usr/autodesk
After that I used Terminal to install Skype and get this error message
Setting up composite-2014 (2014.0-862716) ...
python: can't open file '/usr/autodesk/Composite_2014/etc/configure.py': [Errno 2] No such file or directory
dpkg: error processing composite-2014 (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
composite-201400
E: Sub-process /usr/bin/dpkg returned an error code (1)
I will now install Wine and put the whole process and it will be more clear where the error occur.
Here's the installation process
Errors were encountered while processing:
composite-2014
E: Sub-process /usr/bin/dpkg returned an error code (1)
try this commands:
apt-get install -f
dpkg-reconfigure -a
maybe helps
If the last answer don't work as well (like it happens to me .. and its rear)
Just "Fake" /usr/autodesk/Composite_2014/etc/configure.py
Open the Terminal (ctl+alt+t)
sudo nautilus
Browse to /usr/autodesk and create Composite_2014/etc/configure.py (one by one)
good luck