CentOS 7: reinstalling python2.7 and yum - python-2.7

I removed by mistake /usr/lib64/libpython2.7.so, and as a consequence, yum does not work.
So I'm trying to reinstall python2.7.18 (which is the version that I currently have) from source, but in compilation I get that some modules are missing
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _curses _curses_panel
_ssl _tkinter bsddb185
bz2 dl imageop
readline sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
But:
yum doesn't work, pip2 also doesn't work, setuptools for python setup.py install is not found...
And all solutions I'm finding involve some of those, so I'm getting into some circular problem here.
I looked for the *.rpm for python 2.7.18 for CentOS 7, in the hope I could just install it with rpm and solve the issue, but I couldn't find it.
Any idea?

Found a solution, starting from here.
After manually rm-ing all the /usr/**/*python2.7* files (probably just the libpython2.7.so* and the python2.7 executables would be enough), from
http://mirror.centos.org/centos/7/os/x86_64/Packages/, I downloaded
bzip2-devel-1.0.6-13.el7.x86_64.rpm
compat-db-4.7.25-28.el7.x86_64.rpm
dlm-devel-4.0.7-1.el7.x86_64.rpm
dlm-lib-4.0.7-1.el7.x86_64.rpm
gdbm-1.10-8.el7.x86_64.rpm
gdbm-devel-1.10-8.el7.x86_64.rpm
keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm
krb5-devel-1.15.1-46.el7.x86_64.rpm
libcom_err-devel-1.42.9-17.el7.x86_64.rpm
libdb-devel-5.3.21-25.el7.x86_64.rpm
libdb-tcl-5.3.21-25.el7.x86_64.rpm
libdb-tcl-devel-5.3.21-25.el7.x86_64.rpm
libselinux-devel-2.5-15.el7.x86_64.rpm
libsepol-devel-2.5-10.el7.x86_64.rpm
libverto-devel-0.2.5-4.el7.x86_64.rpm
ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm
openssl-devel-1.0.2k-19.el7.x86_64.rpm
pkgconfig-0.27.1-4.el7.x86_64.rpm
python-2.7.5-88.el7.x86_64.rpm
python-devel-2.7.5-88.el7.x86_64.rpm
python-libs-2.7.5-88.el7.x86_64.rpm
python-pycurl-7.19.0-19.el7.x86_64.rpm
sqlite-3.7.17-8.el7_7.1.x86_64.rpm
sqlite-devel-3.7.17-8.el7_7.1.x86_64.rpm
sqlite-tcl-3.7.17-8.el7_7.1.x86_64.rpm
python-setuptools-0.9.8-7.el7.noarch.rpm
python-six-1.9.0-2.el7.noarch.rpm
python-tools-2.7.5-88.el7.x86_64.rpm
python-urlgrabber-3.10-10.el7.noarch.rpm
readline-6.2-11.el7.x86_64.rpm
readline-devel-6.2-11.el7.x86_64.rpm
popt-devel-1.13-16.el7.x86_64.rpm
rpm-4.11.3-43.el7.x86_64.rpm
rpm-apidocs-4.11.3-43.el7.noarch.rpm
rpm-build-4.11.3-43.el7.x86_64.rpm
rpm-build-libs-4.11.3-43.el7.x86_64.rpm
rpm-devel-4.11.3-43.el7.x86_64.rpm
rpmdevtools-8.3-5.el7.noarch.rpm
rpm-libs-4.11.3-43.el7.x86_64.rpm
rpm-python-4.11.3-43.el7.x86_64.rpm
sqlite-3.7.17-8.el7_7.1.x86_64.rpm
sqlite-devel-3.7.17-8.el7_7.1.x86_64.rpm
tcl-devel-8.5.13-8.el7.x86_64.rpm
tix-8.4.3-12.el7.x86_64.rpm
tix-devel-8.4.3-12.el7.x86_64.rpm
tk-devel-8.5.13-6.el7.x86_64.rpm
tkinter-2.7.5-88.el7.x86_64.rpm
yum-3.4.3-167.el7.centos.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
zlib-devel-1.2.7-18.el7.x86_64.rpm
and installed them with sudo rpm -Uvh --replacepkgs --force *.rpm.
Yum works fine now.

Related

libcurl4-openssl-dev:armhf cannot be installed when libcurl4-openssl-dev is already installed

I have created a c++ app on Debian Jessie 8.10 amd64 which also need the following libraries:
sudo apt-get install libssl-dev
sudo apt-get install libcurl4-openssl-dev
I also need to cross compile the source code for armhf. So according to this quite helpful link https://wiki.embeddedarm.com/wiki/Jessie_armhf_Cross_Compile I gave the following commands:
sudo apt-get install curl build-essential
su root
echo "deb http://emdebian.org/tools/debian jessie main" >
/etc/apt/sources.list.d/emdebian.list
curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -
dpkg --add-architecture armhf
apt-get update
apt-get install crossbuild-essential-armhf
Everything got installed correctly and then I also gave :
sudo apt-get install libssl-dev:armhf
sudo apt-get install libcurl4-openssl-dev:armhf
The first command executed successfully. On the other hand the second one failed giving the following output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
libcurl4-doc:armhf libcurl3-dbg:armhf libidn11-dev:armhf libkrb5-dev:armhf libldap2-dev:armhf
librtmp-dev:armhf libssh2-1-dev:armhf pkg-config:armhf
The following NEW packages will be installed:
libcurl4-openssl-dev:armhf
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
23 not fully installed or removed.
Need to get 0 B/316 kB of archives.
After this operation, 863 kB of additional disk space will be used.
(Reading database ... 94032 files and directories currently installed.)
Preparing to unpack .../libcurl4-openssl-dev_7.38.0-4+deb8u8_armhf.deb ...
Unpacking libcurl4-openssl-dev:armhf (7.38.0-4+deb8u8) ...
dpkg: error processing archive /var/cache/apt/archives/libcurl4-openssl-dev_7.38.0-4+deb8u8_armhf.deb (--unpack):
trying to overwrite shared '/usr/include/curl/curlbuild.h', which is different from other instances of package libcurl4-openssl-dev:armhf
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Processing triggers for man-db (2.7.0.2-5) ...
Errors were encountered while processing:
/var/cache/apt/archives/libcurl4-openssl-dev_7.38.0-4+deb8u8_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Since I'm quite new in cross compilation procedures does anyone have any idea what I'm doing wrong?
You are doing nothing wrong. It is a file conflict in related with multiarch packages. It is a bug in the package
Here is a explanation of this kind of bugs, from https://wiki.debian.org/MultiArch/Hints
The package in question is marked Multi-Arch: same, but has
conflicting versions of at least one file for different architectures.
The hint tells the filename (or the number of filenames) and the
architectures (or number of architectures) in question. The easiest
way to fix is to remove the Multi-Arch: same declaration, but often
enough it can be fixed by moving the offending files to
per-architecture locations (typically
/usr/lib/$(DEB_HOST_MULTIARCH)/). For *-dev packages, the Multi-Arch:
same capability often is not critical and removing is a good initial
measure.
I just run into the same kind of problem, which still is an issue with some packages. In my case libcurl-openssl-dev was replacing the /usr/bin/curl-config binary.
To me it required swapping from x64/i386 libraries when i needed cross-compiling but i am well aware it might not be possible for everyone.

Setting up qt4py2 with with python 2.7 in virtualenv - cannot find the files :(

hopefully this question fits here, I have tried googling and reading "http://pyqt.sourceforge.net/Docs/PyQt4/installation.html" but unfortunately I'm such a newbie in all things linux that I cannot figure out what applies here...
anyway:
I have a virtual env (in Python 2.7)
I am trying to set up labelImg as instructed in : https://github.com/tzutalin/labelImg, specifically I run (with my virtualenv active):
sudo apt-get install pyqt4-dev-tools
sudo pip install lxml (<- did run this as "pip install lxml")
Then I run into problems with this:
make qt4py2
I got error:
"make: *** No rule to make target 'qt4py2'. Stop."
Now from googling I got the impression that I should be in the same directory as the make file when I run make (is this even true?), but when I try to find where pyqt4 is, I cannot find the folder (it is not in ~/.virtualenvs/virP2/lib/python2.7/site-packages$ (virP2 is the name of the virtualenv)
I have also tried to run (with the virP2 still active)
sudo apt-get install python-qt4
but I got:
"python-qt4 is already the newest version"
and I still cannot find where the directory with qt4 files is. (I also looked into the python2.7 folder outside the virtualenv, but it was not there)
Thanks for any advice!

ROS Kinetic: No script named 'rosdep' although it is installed

I have a problem using ROS Kinetic in Ubuntu 16.04.
It was working normally but suddenly rosdep dissapeared while I was trying to configure the Turtlebot Simulator and the AR Drone Autonomy Package.
When I type sudo rosdep init it shows the next error
Traceback (most recent call last):
File "/usr/local/bin/rosdep", line 4, in <module>
__import__('pkg_resources').run_script('rosdep==0.11.5', 'rosdep')
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 739,in run_script
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1486, in run_script
pkg_resources.ResolutionError: No script named 'rosdep'
I tried to install rosdep manually with sudo apt-get install python-rosdep but it shows that python-rosdep is already the newest version (0.11.5-1)
I tried uninstalling ROS using sudo apt-get purge ros-* and sudo apt-get autoremove and installing it again.
And also reinstalling it using sudo apt-get install --reinstall ros-kinetic-desktop-full but no working.
I am following the instructions of the official
site .
Any idea of what can I do to solve this? Thanks
rosdep is actually completely independent from all the ros-** packages because it is used to install them, which is why reinstalling those packages didn't help.
My best guess would be that you used pip in addition to apt for something with rosdep, and now have 1.5 or 3 different versions of rosdep. Please try removing rosdep installed using apt completely:
apt-get purge python-rosdep and make sure that there are no errors when removing the package. If there are any, post them as comment here. Then, check all python import paths for a folder named rosdep, and remove them. You can find out your python import paths by running the following python script:
import sys
print sys.path
Then, you type which rosdep. If there is a rosdep binary anywhere, remove it. Then you can reinstall rosdep: sudo apt install python-rosdep.

nltk module installation in pip through cmd

When I tried to run this command:
c:\python27\scripts\pip install nltk-3.2.1-py2.py3-none-any
I am getting the error:
no matching distribution found
Although i have installed nltk from
http://www.lfd.uci.edu/~gohlke/pythonlibs/#nltk
Kindly help.
I am working on Windows 8 64-bit Version
Installing new modules can be a nightmare if you are new to Python.First delete any old versions of NLTK if already installed. Open cmd navigate to C:\Users\user\AppData\Local\Programs\Python\Python35-32\Scripts, the default directory, using the command cd path_name_comes_here. Otherwise goto the path where you have installed python and goto the Scripts subfolder and use this path here onwards. Now the most preferred way is to use pip install module_you_want_to_install for anything in python. Pip automatically fetches everything it needs to install said module.
Simply use pip install nltk.
Another method is to use easy_install requirement_or_URL.
Some rare occasions its best to download the wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs and from there you can simply use pip install downloaded_wheel_name again. But make sure to copy the name of the wheel EXACTLY.
Post installation make sure that your package is accessible from C:\Users\user\AppData\Local\Programs\Python\Python35-32\Lib\site-packages or a similar path depending on where you installed python.
Try Anaconda - Instead . Always works
C:\Users\sanan>conda install -c anaconda nltk
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Users\sanan\Miniconda3:
The following NEW packages will be INSTALLED:
nltk: 3.2.4-py36_0 anaconda
The following packages will be UPDATED:
conda: 4.3.23-py36_0 --> 4.3.25-py36_0 anaconda
The following packages will be SUPERSEDED by a higher-priority channel:
conda-env: 2.6.0-0 --> 2.6.0-0 anaconda
Proceed ([y]/n)? y
conda-env-2.6. 100% |###############################| Time: 0:00:00 22.84 kB/s
nltk-3.2.4-py3 100% |###############################| Time: 0:00:02 774.24 kB/s
conda-4.3.25-p 100% |###############################| Time: 0:00:00 578.90 kB/s
After installation is complete .
import nltk
print(nltk.__version__)
C:\Public\Code\textnorm>python attempt1.py
3.2.4

ocropus installation on Ubuntu 11.04

I need to install ocropus on Ubuntu 11.04.
I went through a long and painful process of trying ocropus 0.3 and 0.4 from the project's Downloads page, but to no avail - I could find no way of making it locate tesseract, which it recommended. I labored on Google and came across the page http://code.google.com/p/ocropus/wiki/InstallTranscript.
Great. Except when I issue the command:
hg clone $release https://ocropus.googlecode.com/hg/ ocropus
I get the error message:
abort: unknown revision 'ocropus-0.4.4'!
A post here http://aur.archlinux.org/packages.php?ID=13444 by the maintainer of the ocropus package for archlinux says
they have completely refactored ocropus and at the same time they have also completely removed the old repository so it's not possible to access the old "stable" versions. I suggest using the ocropus-hg package, at least for the time being.
I thought I would go ahead with this idea and issued the command:
hg clone https://ocropus.googlecode.com/hg/ ocropus #I deftly avoid any
mention of the release
The result is I get a folder with a file interestingly named ocroinst. I run it and it says I need to run the following commands:
sudo ./ocroinst packages #checks the dependencies
./ocroinst install #installs ocropus
sudo ./ocroinst dl #downloads models
I was glad and I issued the first command, which is when I got the message:
Package libjpeg8-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package libjpeg8-dev has no installation candidate
I think a certain Murphy may have had a point.
The situation, with an delicious added complication, is this:
(please correct me if I am wrong)
Ubuntu 11.04 comes with libjpeg62-dev. The required version for ocropus is libjpeg8-dev.
Ocropus requires libtiff4-dev, and libtiff4-dev depends on libjpeg62-dev. Therefore there is no way for me to uninstall libjpeg62-dev.
libjpeg62-dev conflicts with libjpeg8-dev. Therefore, I can have only one of libjpeg8-dev or libjpeg62-dev, and never both.
If libjpeg8-dev is installed, I will have no libjpeg62-dev, which means I must remove libtiff4-dev and therefore have no way to install ocropus.
If libjpeg62-dev is installed, I will have no libjpeg8-dev and thus I will have no way to install ocropus.
NOTE:
(An experiment description)
I had libjpeg62-dev installed on the system already. I figured I could take a chance and I went right ahead and changed every libjpeg8-dev I could find to libjpeg-dev, and ran the 3 commands.
It installed. No error.
This gave me great joy
until
I ran the command
ocropus <image-file-name>
and I was greeted by the charming:
ImportError: /usr/local/lib/python2.6/dist-packages/_iulib.so: undefined symbol: _ZN5iulib6dcloseEv
The more sophisticated
ocropus book2pages out image*
failed with the same error. A post on stack overflow indicates that this is caused by incorrectly versioned libraries.
THE QUESTION:
How should I proceed?
Thanks in advance.