3

I am tring to install openstack client on Centos 7 virtual machines over pip via this command:

pip install python-openstackclient

At the end of installation I receive this error:

Command "/usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-noqgbvv4/netifaces/setup.py';f=getattr(tokenize, 'open', open)(_file_);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, _file_, 'exec'))" install --record /tmp/pip-eyssu5xp-record/install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-noqgbvv4/netifaces/

Could anybody help me and explain me where is the problem, because the error message is not very clear for me.

I installed openstack client on my personal PC with kubuntu and it works without any problem.

Edit: I run pip with --log option. This is last exception

Exception information:
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.4/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/lib/python3.4/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/lib/python3.4/site-packages/pip/req/req_install.py", line 878, in install
    spinner=spinner,
  File "/usr/lib/python3.4/site-packages/pip/utils/__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "/usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-07sbmmn8/netifaces/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-u60jwjmb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-07sbmmn8/netifaces/
  • If present, can you post the contents of $HOME/.pip/pip.log? – I_GNU_it_all_along Jan 4 '18 at 14:23
  • There is no pip.log at home directory. I try find pip.log at '/' via "find / -name pip.log" but no findings occur. – dorinand Jan 4 '18 at 14:28
  • I also tried upgrade pip with pip install --upgrade pip but pip is already up-to-date. – dorinand Jan 4 '18 at 14:32
  • It would be a level below the home directory, in .pip/ – I_GNU_it_all_along Jan 4 '18 at 14:35
  • if still not there, try the install again but specify a log file using the --log switch. – I_GNU_it_all_along Jan 4 '18 at 14:36
4

By default only Python 2.7 is shipped with CentOS 7, so using pip instead of pip3 only builds from Python 2.7.

You'll want to enable EPEL repository, then install Python 3.4 and then get pip3.

sudo yum install epel-release
sudo yum install python34 python 34-setuptools
sudo easy_install-3.4 pip 

then go back and run

pip3 install python-openstackclient

I did some additional digging for you and it turns out that OpenStack has a repository for CentOS (not surprising since RedHat basically owns OpenStack). So you just really need to do

sudo yum install centos-release-openstack-pike 
sudo yum upgrade
sudo yum install python-openstackclient openstack-selinux 

The last to help you with managing SELinux on CentOS. But, it's still good to know how to get Python 3.4 on your CentOS VM and that you have to use pip3 for Python 3 pip packages.

  • I tried it before with python2 and then with python3. The problem is still the same. Your first advice does not work for me, problem persist. The installation over CentOS repository was successfull. – dorinand Jan 4 '18 at 15:11
  • 1
    Red Hat doesn't own OpenStack. Not even a teeny tiny bit. Surprisingly, RedHat basically does not own OpenStack. – Bananguin Jan 4 '18 at 15:27
  • My guess because there’s a specific SELinux specific RPM pip ran into all sorts of blocks. If you’re curious you can check by doing a $ sudo yum install setroubleshoot-server then running $ sudo sealert-a /var/log/audit/audit.log'. If there’s a ton it would easier set SELinux to permissive $ sudo setenforce 0, install with pip then set SELinux back to enforcing $ sudo setenforce 1. $ sestatus` gives you what state SELinux is on. – Karaface Jan 4 '18 at 15:42
  • Sorry about the commentary with OpenStack. It’s just an allusion about Red Hat’s presence on the direction that OpenStack takes. You are 100% factually correct. – Karaface Jan 4 '18 at 15:50
  • Since I don't have the reputation to comment on your answer, I have to do it here. You'll want to yum groupinstall "development tools" to make sure you have everything, it's similar to Ubuntu's apt-get build-essential. – Karaface Jan 4 '18 at 16:59
2

Solved by installing python-devel and gcc. Also answer of @Karaface was right. The both ways works fine right now. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.