Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

ImportError: No module named xmlrpc_client #55

Closed
djjonno opened this issue Aug 9, 2014 · 40 comments
Closed

ImportError: No module named xmlrpc_client #55

djjonno opened this issue Aug 9, 2014 · 40 comments
Assignees

Comments

@djjonno
Copy link

djjonno commented Aug 9, 2014

Traceback (most recent call last):
File "/usr/local/bin/supernova", line 9, in
load_entry_point('supernova==1.0.2', 'console_scripts', 'supernova')()
File "/Library/Python/2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Python/2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2311, in load_entry_point
return ep.load()
File "/Library/Python/2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2017, in load
entry = import(self.module_name, globals(),globals(), ['name'])
File "/Library/Python/2.7/site-packages/supernova/executable.py", line 31, in
from . import supernova
File "/Library/Python/2.7/site-packages/supernova/supernova.py", line 24, in
from novaclient import client as novaclient
File "/Library/Python/2.7/site-packages/novaclient/client.py", line 45, in
from novaclient import utils
File "/Library/Python/2.7/site-packages/novaclient/utils.py", line 27, in
from novaclient.openstack.common import jsonutils
File "/Library/Python/2.7/site-packages/novaclient/openstack/common/jsonutils.py", line 52, in
import six.moves.xmlrpc_client as xmlrpclib
ImportError: No module named xmlrpc_client

@major major self-assigned this Aug 12, 2014
@major
Copy link
Owner

major commented Aug 12, 2014

Hey, @andjonno. I haven't been able to reproduce this with these Python modules (the latest available):

supernova==1.0.1
python-novaclient

Could you ensure that you have the latest versions of both? Try this:

pip install -U supernova
pip install -U python-novaclient

@djjonno
Copy link
Author

djjonno commented Aug 14, 2014

@major
I have the latest versions.

I am running OS X Yosemite, so maybe something to do with that.

Thanks for getting back to me.

@major
Copy link
Owner

major commented Aug 14, 2014

First off, I'd highly recommend installing python via Homebrew and using that python installation for your daily work. Using OS X's built in python and python modules will eventually lead to peculiar situations like these.

It seems like the six python module might be part of the problem. If you _really really_ want to use OS X's built in python, you could try:

pip install -U six

@haoquanwang
Copy link

Reinstalling python-novaclient via pip did not help but uninstall and install via easy_install workded for me. It seems the issue is related to xcode upgrades.

@hongxiaolong
Copy link

@haoquanwang
When I am running OS X Yosemite and debuging in PyCharm, I find the same problem with you, like this:
No module named xmlrpc_client.

How did you solved by uninstalling and installing via easy_install ?

I uninstalled and reinstalled setuptools in PyCharm, it can not solved the problem.

@djjonno
Copy link
Author

djjonno commented Oct 20, 2014

@xiaolonginfo It was a problem with Yosemite and Xcode I believe. I updated both and it now works.

@matthewfischer
Copy link

I'm using the latest Yosemite and xcode (installed Sunday) and still having this issue, even with a fresh brew install of python. Is there more to your fix?

@major
Copy link
Owner

major commented Oct 20, 2014

I'm not on Yosemite yet but let me know if there's anything I can do to help. ;)

@matthewfischer
Copy link

Well I solved it but it took a large hammer.

First I removed most of the pip packages and then reinstalled xcode. I then fixed the permissions on some of the stuff like pbr and installed python with brew (root had previously owned the pbr lib). Then I got a "golden" list of openstack client libs from a colleague since the latest copies of neutron had new errors.

The bottom line here is that using brew to install python and then making sure that installs clean and works and then installing the libraries with -U seems to be the right fix. The xcode reinstall was due to my own negligence on removing things most likely.

@hongxiaolong
Copy link

@andjonno @major @matthewfischer
I solved this problem by using virtualenv installed by "pip install virtualenv" and then succeed install six packages(six==1.7.3 containing xmlrpc_client) in virtualenv.

By the way, after the above problem I am still troubled with Yosemite and Xcode 6.0.1 because of some similar problems like "pip install cffi", I finally solved by set environment variable PKG_CONFIG_PATH including the software paths from brew install.

Help it useful for you.

@haoquanwang
Copy link

@xiaolonginfo

I had similar problem when I upgraded OS X from 10.7.5 to 10.9, so does upgrading from 10.9 to 10.10. I believe the problem is related to system env variables which were override during the upgrade.

I uninstalled the whole python-novaclient stack:

pip uninstall python-novaclient requests iso8601 python-keystoneclient Babel six simplejson pbr PrettyTable oslo.utils argparse netaddr oslo.config stevedore pytz pip oslo.i18n

And then I reinstalled them back via easy_install:

easy_install python-novaclient requests iso8601 python-keystoneclient Babel six simplejson pbr PrettyTable oslo.utils argparse netaddr oslo.config stevedore pytz pip oslo.i18n

@joevgear
Copy link

I tried the above solutions still not getting this to work, i did an upgrade to yosemite and it was working before that. I have not done anything with xcode only installed the latest but anything i should do there? Should i uninstall and reinstall?

I tried to uninstall python-novaclient with pip and reinstall with pip in a virtualenv and still saw the same issue.

@joevgear
Copy link

I found out that my PyCharm was pointing to the system python. After i made pycharm point to the virtualenv python it is working fine.

@major
Copy link
Owner

major commented Oct 23, 2014

Looks like y'all might have it under control. Let me know if we need to patch supernova.

@major major closed this as completed Oct 23, 2014
@smashhuevo
Copy link

Same problem; I've tried several of these solutions to no avail on Yosemite.

  • updating to latest versions of supernova and python-novaclient
  • uninstalling novaclient and dependencies via pip, and re-installing via easy_install
  • skipped xcode uninstall/reinstall; this is painful and might damage my existing ruby project (which uses GCC)
  • no PyCharm installed on my machine

@major
Copy link
Owner

major commented Dec 15, 2014

@smashhuevo Are you using Yosemite's built in python (bad idea) or a version of python from homebrew? If you really really want to use Yosemite's built in python, I'd highly recommend setting up a virtualenv for use with supernova.

@smashhuevo
Copy link

I'm using the latest homebrew version of Python--yeah, the built-in python does seem like a not-so-good idea.

@dblacka
Copy link

dblacka commented Jan 5, 2015

I ran into this problem as well using Yosemite's system python. The actual issue is that the six.py that comes with the system python doesn't define the six.moves.xmlrpc_client alias, but the version installed via pip into site-packages does. To fix it, we just need to get site-packages in the python path (i.e., sys.path) before the path to the system-provided version. Interestingly, using 'easy_install' to install six works, because easy_install will add the /Library/Python/2.7/site-packages path to ../site-packages/easy-install.pth file, which has a bit of code in it to force those paths to the front.

@lxstar
Copy link

lxstar commented Jan 13, 2015

@dblacka thanks.
I upgrade openstack_dashboard requirement and same program ImportError: No module named xmlrpc_client

and

pip uninstall six
easy_install six

so success.

@christx2
Copy link

christx2 commented Feb 2, 2015

worked for me too, looks like /Library/Python/2.7/site-packages now contains all six packages, and
that does the trick with the existing OSX python (I'm ok with it), no more xmlrpc error with keystone clients. cheers.

@fiorix
Copy link

fiorix commented Feb 9, 2015

easy_install works but requires root on OS X, which is not ideal. pip install --user installs just fine but then heat and other programs fail with the ImportError: No module named xmlrpc_client.

I'm currently using pip on virtualenv and it works fine.

@rashmi-cliqr
Copy link

I had to reinstall XCODE and run :
pip uninstall six
easy_install six

It solved the "ImportError: No module named xmlrpc_client" for yosemite os for me

@gkesavan
Copy link

I had the same module missing issue but uninstalling modules and installing them using easy_install fixed the issue, thanks @haoquanwang for the suggestion. it works.

@ghost
Copy link

ghost commented Apr 29, 2015

I was facing this issue on Yosemite and I followed the instructions that @haoquanwang gave. That has helped. Thanks @haoquanwang!

@christx2
Copy link

Btw, virtualenv is an epiphany for me. If you have not tried it, give it a go for openstack clients, and avoiding a repeat of the xmlrpc error (which keeps occurring after an easy_install update) for me.
Highly recommend as this root user side installation of python and xcode don't seem to like each other.

@zhuronghua
Copy link

thanks @dblacka. easy_install six works!

@IrvingSun
Copy link

thanks, it works!@dblacka

@Muscliy
Copy link

Muscliy commented Jul 28, 2015

when i start create my project , the terminal tell me:
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 7, in
from scrapy.cmdline import execute
File "/Library/Python/2.7/site-packages/scrapy/init.py", line 48, in
from scrapy.spiders import Spider
File "/Library/Python/2.7/site-packages/scrapy/spiders/init.py", line 10, in
from scrapy.http import Request
File "/Library/Python/2.7/site-packages/scrapy/http/init.py", line 12, in
from scrapy.http.request.rpc import XmlRpcRequest
File "/Library/Python/2.7/site-packages/scrapy/http/request/rpc.py", line 7, in
from six.moves import xmlrpc_client as xmlrpclib
ImportError: cannot import name xmlrpc_client

@Muscliy
Copy link

Muscliy commented Jul 28, 2015

@superdump
Copy link

This has a pretty good description of the issue and a possible workaround, although perhaps the PYTHONPATH environment variable workaround is better: http://stackoverflow.com/questions/27668081/how-to-install-six-moves-xmlrpc-client

@samyouxyz
Copy link

Did you try this? It worked for me.

sudo rm -rf /Library/Python/2.7/site-packages/six*
sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six*
sudo pip install six

@superdump
Copy link

I'm not sure removing files from a system framework is a good idea.

@rashmi-cliqr
Copy link

Removing and installing six worked for me as well...

On Tue, Aug 18, 2015 at 12:12 AM, Ratanaksamrith You <
notifications@github.com> wrote:

Did you try this? It worked for me.

sudo rm -rf /Library/Python/2.7/site-packages/six*
sudo rm -rf
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six*
sudo pip install six


Reply to this email directly or view it on GitHub
#55 (comment).

@superdump
Copy link

The workaround noted by @yrsamrith can work, but I don't think it is a good idea to permanently remove files from a system framework. Perhaps other applications are dependent on those files. How do you get them back? What if you need to use both nova and the other application simultaneously? It's not a good solution.

@superdump
Copy link

You removed the package from /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six* which is part of the Python framework on OS X. When you run pip install, it will then be installed, I expect, to /Library/Python/2.7/site-packages/six. The six that is part of Python.framework is gone. Maybe some application is dependent on that specific version and now you can't get it back.

@p0123n
Copy link

p0123n commented Sep 23, 2015

Ty @superdump, your solution with PYTHONPATH works!

sudo rm -rf /Library/Python/2.7/site-packages/six*

Guys, if you don't want, you don't need to remove old six version, you can just backup it to the somethig like six.py.bak It works also.

@pilasguru
Copy link

The solution of @dblacka dated Jan 13 works for me (thank you!)
(Yosemite and I run all pip and easy_install commands as root)

@v1k0d3n
Copy link

v1k0d3n commented Oct 22, 2015

another plug for @haoquanwang. worked like a charm!

@ghost
Copy link

ghost commented Dec 9, 2015

only doing below works for me.
pip uninstall six
easy_install six
It solved the "ImportError: No module named xmlrpc_client" for yosemite os for me
]$nova --version
2.35.0

@zhumojun
Copy link

zhumojun commented Apr 5, 2016

I solved this issue by reinstall the package via easy_install

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests