Skip to content
This repository has been archived by the owner on Feb 25, 2018. It is now read-only.

'importlib._bootstrap' has no attribute 'SourceLoader' #94

Closed
JPFrancoia opened this issue Oct 27, 2015 · 8 comments
Closed

'importlib._bootstrap' has no attribute 'SourceLoader' #94

JPFrancoia opened this issue Oct 27, 2015 · 8 comments

Comments

@JPFrancoia
Copy link

Hi,

I'm trying to build an app. It was working before (ok, maybe some months ago. Since then, python 3.5 went out).

I have the following exception:

File "/usr/lib/python3.5/site-packages/esky/util.py", line 578, in compile_to_bytecode
    loader = importlib._bootstrap.SourceLoader()    
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceLoader'

I'm using:
Python 3.5.0
Esky 0.9.9 (latest) from pypi
cx_freeze 4.3.4-2

And I'm on Manjaro (Linux). It seems to be related to #67 somehow, but I'm not really sure. Could you give me a hand please ?

@JPFrancoia
Copy link
Author

Ok, I spent the day on this issue, with the help of others.

I first monkey-patched esky:
http://stackoverflow.com/questions/33365471/importlib-bootstrap-has-no-attribute-sourceloader#

Some little changes:
loader = importlib._bootstrap_external.SourceLoader()

We assumed that esky is not compatible yet with python 3.5.
So maybe you could add a condition for python 3.5 ?

Once this corrected, the build completed, but I got another error when trying to run the exe:

ImportError: No module named '_frozen_importlib_external'
Fatal Python error: Py_Initialize: importlib install failed

This one is because cx_Freeze "can not see an import":
https://bitbucket.org/anthony_tuininga/cx_freeze/issues/156/running-frozen-app-with-python-35-no

By applying the patch here:
https://bitbucket.org/anthony_tuininga/cx_freeze/pull-requests/83/python-35-compatibility-for-cx_freeze-4x/diff

I could solve the issue. But as I use scipy in my program, I got one last error:

Error importing scipy: you cannot import scipy while
being in scipy source directory; please exit the scipy source
tree first, and relaunch your python intepreter.

I found the solution here:
http://stackoverflow.com/questions/32432887/cx-freeze-importerror-no-module-named-scipy

By patching cx_Freeze again, I finally got my program running.

I let this here for posterity, or in case someone runs into the same problems.

@timeyyy
Copy link
Contributor

timeyyy commented Oct 28, 2015

Thanks for your work, see this post for more info on our plans #95,

@JPFrancoia
Copy link
Author

I can probably make a PR. Would it help ?

@timeyyy
Copy link
Contributor

timeyyy commented Nov 2, 2015

that would be awesome

@JPFrancoia
Copy link
Author

Ok, I will try. Do I also have to write some tests ?

@timeyyy
Copy link
Contributor

timeyyy commented Nov 2, 2015

We are using travis ci to run the tests when pull requests are pushed (across multiple versions). I don't think you need to write more tests, as long as the tests that we have pass on 2.7 +,

@JPFrancoia
Copy link
Author

Ok, I'm still not confortable with the PR process, but I think it's ok now. I just made one. It solved my issue (at least for the Esky part).

@timeyyy timeyyy closed this as completed in 7a9ce9b Nov 3, 2015
timeyyy added a commit that referenced this issue Nov 3, 2015
Python 3.5 compatibility. Fixes #94.
@timeyyy
Copy link
Contributor

timeyyy commented Nov 4, 2015

@JPFrancoia Thanks

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

2 participants