Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Error during pip install #79

Closed
dripton opened this Issue · 13 comments

5 participants

@dripton

This is on an ubuntu 12.04 box with Python 2.7.3

$ sudo pip install jedi
Downloading/unpacking jedi
Downloading jedi-0.5b4.tar.gz (71Kb): 71Kb downloaded
Running setup.py egg_info for package jedi

package init file 'jedi/mixin/__init__.py' not found (or not a regular file)
warning: no previously-included files matching '*.pyc' found under directory '*'

Installing collected packages: jedi
Running setup.py install for jedi
package init file 'jedi/mixin/init.py' not found (or not a regular file)
SyntaxError: ('invalid syntax', ('/usr/local/lib/python2.7/dist-packages/jedi/mixin/_functools.py', 9, 42, ' return self.__func(self.__args, *args, *self.keywords, **kwargs)\n'))

@davidhalter
Owner

Yeah I know about that. I really don't like it.

PR #65 tried to fix it, but I rejected the patch because I don't want to change my architecture just because pip is complicated and not configurable.

So if anyone has any ideas on how to include *.py files in pip without compiling them, please tell me!

@killarny

I don't know how helpful this is, but I get the same issue when using pip to install directly from master:

$ pip install git+git://github.com/davidhalter/jedi.git
Downloading/unpacking git+git://github.com/davidhalter/jedi.git
  Cloning git://github.com/davidhalter/jedi.git to /tmp/pip-JIezLR-build
  Running setup.py egg_info for package from git+git://github.com/davidhalter/jedi.git

    package init file 'jedi/mixin/__init__.py' not found (or not a regular file)
    warning: no previously-included files matching '*.pyc' found under directory '*'
Installing collected packages: jedi
  Running setup.py install for jedi
    package init file 'jedi/mixin/__init__.py' not found (or not a regular file)
    SyntaxError: ('invalid syntax', ('/home/luke/.virtualenvs/python-gedit-jedi/lib/python2.7/site-packages/jedi/mixin/_functools.py', 9, 42, '        return self.__func(*self.__args, *args, **self.keywords, **kwargs)\n'))


    warning: no previously-included files matching '*.pyc' found under directory '*'
Successfully installed jedi
Cleaning up...

I get the same SyntaxError when I manually clone jedi and run python setup.py install too.

@davidhalter
Owner

Yeah sorry, it's not about pip it's about the whole setup.py configuration. I forgot to mention that.

I'm really not an expert in the whole MANIFEST.in and setup.py area.

If anyone could look into the internals of setup.py and tell me if there's a solution for this problem I would be very grateful.

@dbrgn
Collaborator

You should post a question to Stackoverflow concerning this issue.

@killarny

Would this help with including py files that don't get compiled at setup time? It seems like it'd work, but I don't fully understand what your mixin directory is used for (I haven't looked at your code).

I'm a bit of a github noob, so I didn't realize that a pull request would essentially create a new issue. Sorry! Anyway, maybe this would work? #81

@davidhalter
Owner

I tried something like that once, but probably not exactly that. I'll try it tomorrow. Stay put.

BTW: Opening a pull request is certainly ok :-) Even if it is about the same issue.

@davidhalter davidhalter reopened this
@davidhalter
Owner

Sorry, I didn't mean to close it (and the "fix" above doesn't work).

@untitaker

Why do you ship your own version of functools.partial?

The error goes away for me when simply fixing the syntax error in https://github.com/davidhalter/jedi/blob/master/jedi/mixin/_functools.py#L8

class partial():
    def __init__(self, func, *args, **keywords):
        self.__func = func
        self.__args = args
        self.__keywords = keywords

    def __call__(self, *args, **kwargs):
        kwargs.update(self.__keywords)
        return self.__func(*(self.__args + args), **kwargs)
@untitaker untitaker referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@davidhalter davidhalter closed this issue from a commit
@davidhalter merge and a few changes for the SyntaxError problem with mixin in (pi…
…p installation). -> fixes #79, also important for #82, #81, davidhalter/jedi-vim#41, solution from #65
5a7a420
@davidhalter
Owner

@untitaker

I have the feeling that i am not understanding something completely. Why shouldn't the mixin files be compiled?

The mixin files are not real Python files. They are basically just mix-ins for builtins. Why would you do that, you may ask? It's simple: To understand builtins, an autocompletion has to know the output types. But most of the times these are not given or like in the case of list.pop() they depend on the input of list. Therefore I just rewrite some functions in pure Python (a little bit like pypy). These functions are not necessarily valid Python code because no Python interpreter will ever touch them. Jedi is all about types. Syntax errors are not really a problem (and in the case of mix-ins even helpful, because **args1, **args2 is just more straightforward than mangling with dicts).

@untitaker

@davidhalter Thanks, that helped. I would at least add the zip_safe attribute from my pull request to your setup.py, it will improve the installation process slightly, since distutils doesn't have to determine that value on its own.

@davidhalter
Owner

@untitaker Does zip_safe=True also mean that it will be installed as a zip file by default? And why is it faster?

@untitaker
@dbrgn
Collaborator

As far as I understand it, I don't think jedi is zip_safe, as it loads non-python files from its python code (the *.pym files for example). I'd either just skip the entry or set it to False. Correct me if I'm wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.