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

Conda Install cannot use specific version from Binstar? #100

Closed
AnneTheAgile opened this issue May 4, 2014 · 16 comments
Closed

Conda Install cannot use specific version from Binstar? #100

AnneTheAgile opened this issue May 4, 2014 · 16 comments
Labels
locked [bot] locked due to inactivity

Comments

@AnneTheAgile
Copy link

Question continued from #84 entry points not made correctly for skeleton, where @asmeurer kindly offered to hear my problems.

I want to be able to reliably use conda setups with extra pypi packages. I think that is something that is already fully supported. I have sort of gotten a bit working but not much.

I made a bottle package. I actually forget how I created it originally.

Now I made an older version and also put it on binstar. https://binstar.org/AnneTheAgile/bottle/0.11.7

I am very confused because I can't figure out how to invoke different versions.

There looks like a DOC item I'd like to help fix wrt creating an older packge.
First in creating the package at a given pypi version. I tried a bunch of commands and failed, noting the Help does not list --versions, but finally I got a message and used that;

$ conda --version
conda 3.4.2

# Note, one thing I tried and probably would have worked was to Manually edit an example, eg
# https://github.com/conda/conda-recipes/blob/master/bottle/meta.yaml
# or manually edit the 'latest version' which comes by default.

$ conda skeleton pypi bottle-0.11.7
Error: Could not find any versions of package bottle-0.11.7

$ conda skeleton pypi bottle version=0.11.7
WARNING: building more than one recipe at once without --no-download is not recommended
Error: Could not find any versions of package version=0.11.7

$ conda skeleton pypi bottle
Warning, the following versions were found for bottle
....Using 0.12.7
Use --version to specify a different version.
...done

$ conda skeleton -h
usage: conda-skeleton [-h] {pypi,cpan} ...
create skeleton recipes for packages from hosting sites
positional arguments:
  {pypi,cpan}
    pypi       Create recipes from packages on PyPI
    cpan       Create recipes from packages on CPAN
optional arguments:
  -h, --help   show this help message and exit

$ conda skeleton pypi bottle --version 0.10.12
Traceback (most recent call last):...
RuntimeError: directory already exists: ./bottle
# Deleted the folder

# Finally WORKS
$ conda skeleton pypi bottle --version 0.10.12
Using url https://pypi.python.org/packages/source/b/bottle/bottle-0.10.12.tar.gz (56996) for bottle.
Downloading bottle (use --no-download to skip this step)...
Writing recipe for bottle
Done

This part is OK.
I have been working from this SO post,
http://stackoverflow.com/questions/18640305/how-to-keep-track-of-pip-installed-packages-in-an-anaconda-conda-env
which was referenced from;
https://www.linkedin.com/today/post/article/20140107182855-25278008-using-pypi-packages-with-conda
So the next step was to build it ie make the tar.bz, and then upload to binstar.

$ conda build bottle/
BUILD START: bottle-0.10.12-py27_0
....
===== bottle-0.10.12-py27_0 OK =====
TEST END: bottle-0.10.12-py27_0
# If you want to upload this package to binstar.org later, type:
# $ binstar upload /Users/amoroney/anaconda/conda-bld/osx-64/bottle-0.10.12-py27_0.tar.bz2
# To have conda build upload to binstar automatically, use
# $ conda config --set binstar_upload yes

$ binstar upload /Users/amoroney/anaconda/conda-bld/osx-64/bottle-0.10.12-py27_0.tar.bz2
detecting package type ...
conda
...Upload(s) Complete   Package located at:
https://binstar.org/AnneTheAgile/bottle

Now I want to use the uploaded binstar package in a conda environment. I cannot figure out how to get the version.

$ conda info -e
# conda environments:
trynum16              *  ~/anaconda/envs/trynum16
root                     ~/anaconda

$ conda install -c https://conda.binstar.org/annetheagile bottle --version 0.10.12
usage: conda [-h] [-V] command ...
conda: error: unrecognized arguments: --version 0.10.12

$ conda install -c https://conda.binstar.org/annetheagile bottle
Fetching package metadata: ....Solving package specifications: .
# All requested packages already installed.
# packages in environment at /Users/amoroney/anaconda/envs/trynum16:
bottle                    0.12.5                   py27_0

# My binstar correctly has 3 bottle versions.

$ which python
~/anaconda/envs/trynum16/bin/python

$ python
Python 2.7.6 |Anaconda 1.9.2 (x86_64)| (default, Jan 10 2014, 11:23:15)
>>> import bottle
>>> bottle.__version__
'0.12.5'
>>> quit()

@AnneTheAgile
Copy link
Author

Two more DOC bug locations are as follows.

On Binstar, every version on binstar incorrectly tells how to install itself, ie https://binstar.org/AnneTheAgile/bottle/0.11.7 says

 Installers
conda install
This package contains conda packages. To install this package with conda run:
conda install -c https://conda.binstar.org/annetheagile bottle

Conda install doesn't help either. Upon trying that command, as expected, only the latest version is attempted, and it gives no error message on the correct syntax;

$ conda install -c https://conda.binstar.org/annetheagile bottle
...# All requested packages already installed.
# packages in environment at ~anaconda/envs/trynum16:
bottle                    0.12.5                   py27_0

$ conda install -c https://conda.binstar.org/annetheagile bottle --version 0.10.2
usage: conda [-h] [-V] command ...
conda: error: unrecognized arguments: --version 0.10.2

$ conda install -c https://conda.binstar.org/annetheagile bottle --version=0.10.2
usage: conda [-h] [-V] command ...
conda: error: unrecognized arguments: --version=0.10.2

$ conda install -c https://conda.binstar.org/annetheagile bottle --revision=0.10.2
Error: expected revision number, not: '0.10.2'

$ conda install -c https://conda.binstar.org/annetheagile bottle --revision 0.10.2
Error: expected revision number, not: '0.10.2'

//AnneTheAgile

@AnneTheAgile
Copy link
Author

Finally, I wish I knew where to find the code.
Conda-Install I'm not sure where it lives?
Conda-Skeleton I found in this repo , conda-build / bin / conda-skeleton
Conda docs doesn't seem to have what I expected; https://github.com/conda/conda-docs/blob/master/docs/source/commands/build.rst is empty, ie conda-docs / docs / source / commands / build.rst .

@AnneTheAgile
Copy link
Author

Reference URL's
[1] PYPI for a bottle revision; https://pypi.python.org/pypi/bottle/0.11.7
[2] PYPI item on Binstar.org whose DOC says to use Pip -instead- of conda?? https://binstar.org/pypi/numpy/1.6.1
[3] Ana/Conda 3.0 might have upgraded support for "creating conda packages for all pip-installable packages". I might be able to install a preview build somehow?
[4] Sample Bottle recipe, which indeed looks similar to my generated one ; https://github.com/conda/conda-recipes/blob/master/bottle/meta.yaml , ie conda-recipes / bottle / meta.yaml , Aaron Meurer asmeurer 3 months ago Add recipe for bottle
[5] Discussion of how to use Conda for Pip PyPi items, http://www.peterbronez.com/Using%20PyPi%20Packages%20with%20Conda
[6] Public Conda packages on Binstar, https://conda.binstar.org/public/osx-64
[7] Binstar DOC on home page does not mention versions. https://conda.binstar.org/
[8] The basic Conda Example of NumPy fails for me, http://stackoverflow.com/questions/23458593/conda-example-does-not-work-it-shows-newer-not-older-numpy which may be related to Ticket #76 conda skeleton numpy.
[9] Conda Config to add Binstar https://pypi.python.org/pypi/conda/3.0.3
[10] No Conda Pymongo official package http://stackoverflow.com/questions/21354977/python-installing-pymongo-with-anaconda

@AnneTheAgile
Copy link
Author

Conda config for binstar did not work for me either. I added my repo but it complained that osx-64 doesn't exist - even though my only packages all are under /osx-64/ folders.

The docs , https://pypi.python.org/pypi/conda/3.0.3 , said I could create a config item

$ conda config --add channels https://conda.binstar.org/username
# I edited my config manually instead
# I have a new enough conda; 
$ conda --version
conda 3.4.2

$ conda skeleton pypi bottle
Warning, the following versions were found for bottle...
...
Fetching package metadata: ..Traceback (most recent call last):
  File "~/anaconda/bin/conda-skeleton", line 5, in <module>
    sys.exit(main())
  File "~/anaconda/lib/python2.7/site-packages/conda_build/main_skeleton.py", line 124, in main
    args.func(args, p)
  File "~/anaconda/lib/python2.7/site-packages/conda_build/main_skeleton.py", line 135, in execute
    pypi.main(args, parser)
  File "~/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 314, in main
    run_setuppy(src_dir, tempdir, args)
  File "~/anaconda/lib/python2.7/site-packages/conda_build/pypi.py", line 462, in run_setuppy
    'setuptools'], clear_cache=False)
  File "~/anaconda/lib/python2.7/site-packages/conda_build/build.py", line 205, in create_env
    index = get_index([url_path(config.croot)])
  File "~/anaconda/lib/python2.7/site-packages/conda/api.py", line 40, in get_index
    unknown=unknown)
  File "~/anaconda/lib/python2.7/site-packages/conda/utils.py", line 77, in __call__
    value = self.func(*args, **kw)
  File "~/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 114, in fetch_index
    repodata = fetch_repodata(url, use_cache=use_cache)
  File "~/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 91, in fetch_repodata
    raise RuntimeError(msg)
RuntimeError: HTTPError: 404  NOT FOUND  https://binstar.org/annetheagile/osx-64/

# So I removed the offending config, and here is my config now, which WORKS
$ cat  ~/.condarc
create_default_packages:
  - ipython
  - pip

# http://www.peterbronez.com/Using%20PyPi%20Packages%20with%20Conda
channels:
# Can NOT add https://binstar.org/annetheagile , because even though
# ../osx-64/bottle exists, we get;
# RuntimeError: HTTPError: 404  NOT FOUND  https://binstar.org/annetheagile/osx-64/
  - defaults
  - http://conda.binstar.org/pypi

@AnneTheAgile
Copy link
Author

I apologize for so many sections and questions. You can see I've had quite a time! I'd so very much like it to work and be able to train my fellow NYC Pythonistas.

@AnneTheAgile AnneTheAgile changed the title Cannot access specific version on Binstar after conda skeleton pypi, conda build? Conda Install cannot use specific version from Binstar? May 6, 2014
@AnneTheAgile
Copy link
Author

Title changed from: "Cannot access specific version on Binstar after conda skeleton pypi, conda build?"
to: "Conda Install cannot use specific version from Binstar?"

So far the only way I found to do that is to download and install that specific, local package. That seems a bit convoluted? I felt sure I was missing syntax?

I hope for some feedback!

@asmeurer
Copy link
Contributor

asmeurer commented May 6, 2014

Sorry for the inconsistent syntax. The syntax to install a specific version is =, like conda install bottle=0.10.12. Probably conda skeleton should have used that same syntax.

@asmeurer
Copy link
Contributor

asmeurer commented May 6, 2014

You can also give partial versions. conda install bottle=0.10 will install the latest version in the 0.10 series (use 0.10.0 to install exactly 0.10). conda install "bottle>=0.10" will install any version greater than or equal to 0.10 (you need to quote it because otherwise > is interpreted by bash).

Does this answer all your questions?

@asmeurer
Copy link
Contributor

asmeurer commented May 6, 2014

Regarding:

RuntimeError: HTTPError: 404 NOT FOUND https://binstar.org/annetheagile/osx-64/

This didn't work because the correct url is conda.binstar.org. The easiest way is to just add annetheagile to your .condarc. Conda will automatically read this as a binstar username.

@AnneTheAgile
Copy link
Author

Thank you so much @asmeurer, Aaron! Just a couple little questions and I'll close this out and write a summary for "future me".

1.Where does the documentation live for the following items? I will submit PR's now that I've learned something.
1a.Conda-build items;
$ conda skeleton -h # where package_spec is the item not clear
$ conda install -h
$ conda config -h
1b.Conda setup items;
$ source activate
$ source deactivate
1c.Binstar Website pages;
https://binstar.org/annetheagile/bottle # should have custom instructions per-version

2.Where does the following code live on Github?
Conda-Install

3.WORKS now to install a specific version.
My problem was with specifying the version of a binstar package, but now I see from your example that the below works just dandy.

$ conda install  -c https://conda.binstar.org/annetheagile bottle=0.12.5
...Solving package specifications: .

# Then after added to .condarc; channels / annetheagile
$ conda install bottle=0.10.12
Fetching package metadata: ....
Solving package specifications: .

@asmeurer
Copy link
Contributor

asmeurer commented May 6, 2014

The docs that you get for -h is in the code, either here (for skeleton and build), or at https://github.com/conda/conda). The command docs could probably stand to have some better help for the commands themselves.

The Sphinx docs are at https://github.com/conda/conda-docs.

@asmeurer
Copy link
Contributor

asmeurer commented May 6, 2014

Binstar stuff is all at https://github.com/binstar/. The repo for the website is private, though.

@asmeurer
Copy link
Contributor

asmeurer commented May 6, 2014

2.Where does the following code live on Github?

It depends on what you mean. It's all in the conda repo. The command is in conda/cli/install.py, but that calls a lot of other functions, like conda/fetch.py, conda/plan.py, conda/resolve.py, and conda/install.py. Probably most of the code in conda is accessed by conda install.

@AnneTheAgile
Copy link
Author

Ah, Relief! Thank you again @asmeurer ! I feel so much better! This will be fun to put in some documentation items. I would love to have binstar fixed too , but if I fix the others it will be less serious as it is now. thank you!

Details;
Find DOC items by search for "usage:";
[1] Conda/Install ; https://github.com/conda/conda/search?q=%22usage%3A%22&ref=cmdform
[2] Conda/Build/Skeleton ; https://github.com/conda/conda-docs/search?q=usage%3A&ref=cmdform

@AnneTheAgile
Copy link
Author

I'm having another version problem today. Perhaps I should have put this ticket in conda-build; conda/conda#781

@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically locked because it has not had recent activity after being closed.

Please open a new issue if needed.

Thanks!

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Apr 27, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

No branches or pull requests

2 participants