Is there a way to easily obtain a version of pygame that is compatible with Python 3? What if conda cannot find the package I am looking for? Pip install While we could change everything over to Python 2.7, this is not a great solution. No one from the Anaconda community has included a version of pygame in one of the channels that is compatible with Python 3. This is why, to create a virtual environment that is compatible with the version of pygame we asked conda to download, conda is telling us that it has to downgrade several packages, including Python! Specifically, conda wants to downgrade Python from version 3.7.3 to version 2.7.15. That means that packages coded using Python 2 often won’t work when they are run using Python 3. As you may or may not known, the creators of Python made a breaking change from Python 2 to Python 3. It means the pygame package we were about to download was written to work with Python 2.7. The key thing to notice is the py27_0 part. Do you see what went wrong? The package that we were going to download is listed as: Who-oh! That is more than we bargained for. The following NEW packages will be INSTALLED: The following packages will be downloaded: (sci_sound) $ conda install -c cogsci pygameĮnvironment location: /home/martin/anaconda3/envs/sci_sound We need to run conda install -c cogsci pygame to install pygame. If we click the most popular channel, called CogSci, we see the following information: But if we navigate to and search for pygame, we see the following search results: To search for alternate channels that may provide the conda package you'reĪnd use the search bar at the top of the page.Īs you can see, pygame is not available for direct download. PackagesNotFoundError: The following packages are not available from current channels: Note that we start by activating the virtual environment we created in our previous post – it is called sci_sound. The same Python packages can be contained in several channels pick a channel that contains the version of the package that is compatible with your system (32-bit vs 64-bit linux, win, os-x), preferably one that has been downloaded many times as this provides some reassurance that the package works reliably.Īs an example, lets pretend we wanted to include the pygame package to our environment. Think of channels as branches of the Anaconda library. Thankfully, there is a large community of Anaconda users that help fill the gap by providing different channels from which we can download our desired package. What if conda cannot find the package I am looking for? Conda channels In this post we will learn how to add such packages to our Python virtual environments. In our previous post we learned about Python virtual environments and how conda makes it easy for us as scientists to use virtual environments and access hundreds of useful packages.ĭespite the number of packages directly available through conda, not all packages can be downloaded this way.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |