Converting binstar Linux packages to Windows for Anaconda and Python

If you are one of those (growing number of) weirdos who are using the Anaconda distribution of Python on Windows instead of Linux for data-science, you might find this post useful. It happened to me countless times that for some function I wanted to perform, I needed to install an extra Python library. The usual process involves using the default conda package manager by Anaconda and typing

C:\> conda install mybeautifullibrary

and thats about it. But unfortunately in reality somehow something always breaks…

A lot of very useful Python libraries cannot be found on the default conda distribution channel and you get an error message saying: Error: No packages found in current win-64 distribution channels matching: mybeautifullibrary. Therefore you have to get them from from binstar. Conda itself suggests this. So then you follow the advice and you search for your package on binstar:

C:\> binstar search -t conda mybeautifullibrary

Bingo! You found it! Let’s see what do we have:

C:\> binstar show username/mybeautifullibrary

Excited, you are ready to install and do all that work that you have been dreaming of. Except…

C:\> conda install –channel https://conda.binstar.org/username mybeautifullibrary

Error: No packages found in current win-64 distribution channels matching: mybeautifullibrary. You get back the same old error message! Angry and frustrated, you go to binstar.org and search for mybeautifullibrary. You get hits, maybe even from multiple users. So the trick here is that no distributions have been complied yet for Windows for the package you are searching for. But don’t worry you can actually convert an existing linux-64 package to a win-64 package! (the same is true for linux-32 and win-32). Now, how do we do this?

Go ahead and on the binstar.org website search for your package and select a linux-64 distribution (it might work with osx-64, but I haven’t checked). Under the Files tab, download the file – you should get something with .bz2 extension. Let’s say I have downloaded mine to the path D:\ Then go back to the command prompt and use conda convert to convert your downloaded linux-64 package to win-64 – use the flags -p and win-64 after the file name. The command should look roughly like:

C:\> conda convert D:\linux-64-mybeautifullibrary1.0-py27_0.tar.bz2 -p win-64

Voilá! If all goes smoothly, you should have gotten a new directory entitled win-64 at the path you were running the commands from (for me that’s C:\). If you experiencing writing issues, try to run a command prompt again with administrative privileges.

Now you have created our version of the mybeautifullibrary package to be used with Windows! Now you need to upload it to binstar so that you (and us) can install it later with conda. If you haven’t done so already, create a binstar account (make sure you confirm your account from the link in the email they send you before proceeding). That’s it, you’re done with the binstar website for now. Now let’s go back to the command prompt and upload the win-64 package file to your binstar account:

C:\>binstar upload D:\win-64\linux-64-mybeautifullibrary1.0-py27_0.tar.bz2

Enter your login credentials if prompted and your package should upload! Whew. Done. Let’s see: now, when running:

C:\> binstar search -t conda mybeautifullibrary

your newly uploaded package should show up too! Great! Now you should be able install it on your Windows machine using the regular conda procedure:

C:\> conda install –channel https://conda.binstar.org/username mybeautifullibrary

That’s it, victory! Go ahead and do those graphs you’ve been dreaming of now 🙂

Advertisements

3 replies »

  1. Hi Dénes,

    Cool post! It might interest you to know that you can configure conda to automatically upload your packages to binstar (once you’ve completed the original account signup, as you noted) by adding the following to your ~/.condarc file:

    binstar_upload: true

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s