Installing rpm and yum in anaconda python on centos 7 - python

How do I install the redhat yum packages within an anaconda environment on CentOS? These packages exist in the standard Centos dist:
$ lsb_release -d
Description: CentOS Linux release 7.3.1611 (Core)
$ python
Python 2.7.5 (default, Nov 6 2016, 00:28:07)
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpm
>>> import yum
>>> print(rpm.__package__, rpm.__file__, rpm.__path__,rpm.__version__)
('rpm', '/usr/lib64/python2.7/site-packages/rpm/__init__.pyc', ['/usr/lib64/python2.7/site-packages/rpm'], '4.11.3')
>>> print(yum.__package__, yum.__file__, yum.__path__,yum.__version__)
('yum', '/usr/lib/python2.7/site-packages/yum/__init__.pyc', ['/usr/lib/python2.7/site-packages/yum'], '3.4.3')
I can't find similar packages (in the ways that I know) for anaconda:
$ source anaconda3/bin/activate python2.7
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import rpm;
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named rpm
>>> import yum
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named yum
>>>
pip and conda search don't seem to have these packages either.

When you run source
anaconda3/bin/activate python2.7
you are running python2.7 using a different virtual environment, where the package repository is different. You should source into the venv and install the packages there.

Related

Python ImportError: cannot import name 'Uniswap'

Have Problem
fresh install Ubuntu 18 64bit
apt-get update
apt install python3-pip
alias pip=pip3
pip install uniswap-python
root#ubuntu:~# python3
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
from uniswap import Uniswap
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'Uniswap'
what can i do please help

vtk with python 3.6, Anaconda 4.4

I am having the following error when I run vtk with python through anaconda
root#user:~# conda install -c clinicalgraphics vtk=7.1.0
Fetching package metadata ...........
Solving package specifications: .
# All requested packages already installed.
# packages in environment at /home/user/anaconda3:
#
vtk 7.1.0 py36_3 clinicalgraphics
root#user~# python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Traceback (most recent call last):
File "/home/user/anaconda3/lib/python3.6/site-packages/vtk/vtkCommonCore.py", line 5, in <module>
from .vtkCommonCorePython import *
ImportError: /home/user/anaconda3/lib/python3.6/site-packages/vtk/../../../libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/user/anaconda3/lib/python3.6/site-packages/vtk/../../../libvtkCommonCorePython36D-7.1.so.1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/anaconda3/lib/python3.6/site-packages/vtk/__init__.py", line 41, in <module>
from .vtkCommonCore import *
File "/home/user/anaconda3/lib/python3.6/site-packages/vtk/vtkCommonCore.py", line 9, in <module>
from vtkCommonCorePython import *
ModuleNotFoundError: No module named 'vtkCommonCorePython'
I tried using the solution presented in Install vtk with python 3.6 and No module ImportError, they don't seem to work. Surprisingly, I don't face this issue in my Windows distribution. Any alternate suggestion are welcome. I am really trying to avoid downgrading from Python3 to Python2 or using a separate conda environment just for vtk..but if end up doing so...I guess I have to make that work. I tried linking the library of my own build of vtk 8...that doesn't seem to work as well
So I did end up creating a new environment based on menpo vtk=7 python=3 using the following commands
root#user:~# conda create --name VTKpythonENV python=3
.......
root#user:~# conda install -n VTKpythonENV -c menpo vtk=7 python=3
..........
root#user:~# source activate VTKpythonENV
(VTKpythonENV) root#user:~# python
Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 13:51:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
This works for me but other suggestions using clinical graphics vtk are also welcome

Installing Mesos from Mesosphere yum repository

I am trying to install Mesos to in my container (CentOS 7) to have the Mesos libraries installed for my scheduler (python).
I followed 'Installing Mesos packages' section in https://open.mesosphere.com/downloads/mesos/
After successfully running:
$ rpm -Uvh http://repos.mesosphere.com/el/7/noarch/RPMS/mesosphere-el-repo-7-3.noarch.rpm
$ yum -y install --enablerepo=mesosphere mesos
$ pip install protobuf
I see Mesos packages in pip
However, from python, I cannot import Mesos scheduler driver:
Python 2.7.5 (default, Nov 6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mesos.interface import Scheduler
>>> from mesos.native import MesosSchedulerDriver
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/mesos/native/__init__.py", line 18, in <module>
from mesos.scheduler import MesosSchedulerDriver
File "/usr/lib/python2.7/site-packages/mesos/scheduler/__init__.py", line 17, in <module>
from ._scheduler import MesosSchedulerDriverImpl as MesosSchedulerDriver
ImportError: /usr/lib/python2.7/site-packages/mesos/scheduler/_scheduler.so: undefined symbol: svn_txdelta2
Any ideas?
Well, I'm not an expert on this, but I think the packages don't install the development dependencies. Have a look at http://mesos.apache.org/gettingstarted/
In your case, you seem to miss a SVN library.

How do I get Python to see libtorrent-rasterbar in mac os?

I try to install libtorrent-rasterbar, but Python does not see the module. The El Captaine system. Tell me where to look?
andrew: ~ $ brew install python3
Warning: python3-3.6.0_1 already installed
andrew: ~ $ brew install libtorrent-rasterbar
Warning: libtorrent-rasterbar-1.1.1 already installed
andrew: ~ $ python
Python 3.6.0 (default, Mar 4 2017, 12:32:37)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtorrent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'libtorrent'
>>>
For python2 it work: https://gist.github.com/jacobzelek/ecb6e98feb91d911e231
May be for python3 is similarly

How to install pync on mac

I want to install pync on mac for showing notification. I tried with
$ pip install pync
git clone git://github.com/SeTeM/pync.git
cd pync
python setup.py install
sudo easy_install pync
Showing error as :
Last login: Thu Nov 21 12:20:51 on ttys000
fiss-Mac:~ fis$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pync import Notifier
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.8-intel/egg/pync/__init__.py", line 3, in <module>
File "build/bdist.macosx-10.8-intel/egg/pync/TerminalNotifier.py", line 99, in <module>
File "build/bdist.macosx-10.8-intel/egg/pync/TerminalNotifier.py", line 27, in __init__
Exception: pync was not properly installed. Head over to https://github.com/SeTeM/pync/ and file a bug.
>>>
You should try pip3 install pync as pip3 works for mac rather than just pip . That is what you should try . If that doesn't work - then you should try to install it from the GitHub link like said in one of the above answers . Hope I was Helpful !! (:
It seems that the package for pync in the Python Package Index does not work properly.
Installing directly from the pync github repo will resolve the issue:
pip install git+https://github.com/SeTeM/pync.git
Just had the same issue.
Unzipping the egg file helped to solve the issue:
cd /Library/Python/2.7/site-packages
sudo unzip pync-1.4-py2.7.egg
sudo rm -r EGG-INFO pync-1.4-py2.7.egg
$ python
Python 2.7.6 (default, Nov 12 2013, 13:26:39)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pync import Notifier
>>>

Categories

Resources