Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows + python 3.3.0 = trouble #12

Closed
pythonmobile opened this issue Sep 2, 2013 · 11 comments
Closed

Windows + python 3.3.0 = trouble #12

pythonmobile opened this issue Sep 2, 2013 · 11 comments

Comments

@pythonmobile
Copy link

Both easy_install and pip fail. Easy_install actually installed something, after which i get:

from gittle import Gittle
Traceback (most recent call last):
File "", line 1, in
File "C:\Python33\lib\site-packages\gittle-0.2.1-py3.3.egg\gittle__init__.py", line 1, in <module

from . import utils

File "C:\Python33\lib\site-packages\gittle-0.2.1-py3.3.egg\gittle\utils__init__.py", line 1, in <
module>
from . import paths, urls, git
ImportError: cannot import name urls

@jacebrowning
Copy link
Contributor

The error I get from pip is:

C:\Python33\Scripts>pip install gittle
Downloading/unpacking gittle
  Downloading gittle-0.2.2.tar.gz
  Running setup.py egg_info for package gittle

...

running build_ext

building 'Crypto.Random.OSRNG.winrandom' extension

warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

error: Unable to find vcvarsall.bat

----------------------------------------
Cleaning up...
Command C:\Python33\python.exe -c "import setuptools;__file__='c:\\windows\\temp\\pip_build_abrow198\\pycrypto\\setup.py
';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\windows\temp\pip-8i1
e2h-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\windows\temp\pip_build_
abrow198\pycrypto
Storing complete log in C:\Users\abrow198\pip\pip.log

I need Visual Studio installed to pip install gittle?

@AaronO
Copy link
Contributor

AaronO commented Sep 11, 2013

gittle depends on paramiko (SSH protocol in Python) which in turn depends on pycrypto (Cryptographic library).

pycrypto has parts implemented in C++ for performance reasons, gittle itself is pure Python (and is a majority Python has a whole). So my guess is that pycrypto's build is failing for some reason.

This may be a solution http://stackoverflow.com/a/11405614, however I only use Linux and OS X, so it's hard for me to test.

Give the above StackOverflow link a try and let me know how it works out.

@tritium21
Copy link
Contributor

"error: Unable to find vcvarsall.bat"

This is a dead giveaway. This is looking for visual studio to install pycrypto. Visual C++ Express 2008 (free) will suffice, but if you have full Visual C++ 2008, then that will do too. Note the 2008. Python 2.x you download from python.org is compiled with VC2008. Not 2005 or 2010, 2008. VCE2008 is getting a little hard to find, but you can still find it on google.

@jacebrowning
Copy link
Contributor

@tritium21 Thanks!

Unfortunately gittle may not be quite what I'm looking for as a Pythonic interface to git. I would like my packages to be pip-installable without any additional dependencies.

@AaronO
Copy link
Contributor

AaronO commented Sep 26, 2013

@jacebrowning

gittle only requires paramiko (and it's dependency pycrypto) for SSH authentication.

If you're not looking to use that, you could easily remove it as a dependency. Which should also fix your build issues, since the rest of the code is pure python (besides a few optional C optimizations in dulwich).

gittle is pip-installable on Mac & Linux without any extra work. Only windows, has these issues.

@jacebrowning
Copy link
Contributor

@AaronO any chance you could check for paramiko at run-time and/or only install paramiko on Mac/Linux by default?

@AaronO
Copy link
Contributor

AaronO commented Sep 26, 2013

Yes, it should be rather easy in fact.

paramiko is only directly used by gittle in the gittle.auth module (https://github.com/FriendCode/gittle/blob/master/gittle/auth.py#L12), which already supports not having paramiko install in which case it just drops support for SSH authentication with run runtime provided RSA keys (which is perfectly normal, since you can't do that without paramiko).

So gittle already checks for paramiko at run-time and can run without it.

So step 2 would be to make the installation detect that it is windows and not install paramiko

import platform
platform.system()

Returns "Windows" when running on windows, we could use that to check for Windows in setup.py and then remove these two lines (https://github.com/FriendCode/gittle/blob/master/setup.py#L17).

So it should be really easy actually. I don't have a Windows machine to try it on unfortunately. Could you give it a try ?

@jacebrowning
Copy link
Contributor

@AaronO Yes, I can give this a try.

Are you sure platform.sytem() is the best way to check for "Windows"? I'm not sure myself so I asked here: http://stackoverflow.com/questions/19017927/when-should-i-use-os-name-vs-sys-platform-vs-platform-system

@AaronO
Copy link
Contributor

AaronO commented Sep 26, 2013

@jacebrowning

I'm pretty sure it's more than good enough. And if you check the docstring it wil ltell you the following :

Help on function system in module platform:

system()
    Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.

    An empty string is returned if the value cannot be determined.

Submit a pull request if your modifications work for Windows and I'll do a new release specifically for that.

@jacebrowning
Copy link
Contributor

@AaronO the dulwich dependency also requires vcvarsall.bat and it appears I cannot just disable this dependency in setup.py without breaking the installation.

@jelmer
Copy link

jelmer commented Sep 28, 2013

Dulwich should build fine without the C extensions - you can pass --pure to make it skip them. You'll have somewhat degraded performance, but everything should work fine.

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

No branches or pull requests

5 participants