0

I am new to Python, the Anaconda environment, conda, pip, all of it, so please bear with me if these are simple questions. I've asked a couple previous questions about this install which so far have been resolved. Here was my previous question. All of my issues have to do with conda-build meta files which don't work and need some hand-editing in order to succeed.

Background:

I am trying to install the package called ibm-watson in my Python, in a separate conda environment cloned from my base environment. This is in support of a Coursera course. The courseware builds this package in its own Jupyter window with a pip install. I wanted to build the examples in my own environment, and I'm working in Anaconda at the recommendation of many people.

When I first ran into issues with conda-build which I couldn't figure out, I decided to try pip. That worked, but led to other problems (which online articles warned about). Conda (I read) doesn't know about things installed with pip, and that screws up its ability to manage packages and environments. So I decided to back out the pip install and try to make it work with conda.

First question: Why does pip install work correctly and recursively build all dependencies but conda-build does not? Am I just not using the right options for conda?

So here are the meta.yaml issues I've uncovered so far and resolved with the help of people here.

  • Version string that said '>=2.0,' with an extraneous comma.
  • package name that was shown with underscores but actually needed hyphens
  • Dependencies which I fixed by downloading the required packages one by one and building, frequently dealing with the same issues above in the meta.yaml
  • Most recently, this string, which was throwing an error till I guessed that the quote marks were the issue: typing; # [ py <'3.5' ]
  • Also the install command from the conda documentation conda install --use-local my-package doesn't work, and per a discussion on Github, I am instead using conda install -c ${CONDA_PREFIX}/conda-bld/my-package

Second question: Why is the conda process so buggy? Are the IBM developers just careless in their testing or is it conda that's at fault or am I using all of this wrong?

And finally, the real question

The last dependency I had to build was python-dotenv installed from PyPi. I built that with conda like the others:

conda skeleton pypi python-dotenv
conda-build python-dotenv  (after making the above change to meta.yaml)

That gets all the way through building but then throws this error:

Run pip install "python-dotenv[cli]" to fix this.Tests failed for python-dotenv-0.11.0-py37_0.tar.bz2 - moving package to /Users/(myname)/opt/anaconda3/envs/coursera/conda-bld/broken

Since I'm not using pip, how do I do what it's asking me to do? I tried just doing conda-build "python-dotenv[cli]" but got "no valid recipes for python-dotenv[cli]".

Community
  • 1
  • 1
Randy Poe
  • 1
  • 2
  • The reason it mentions `pip` is probably because your `meta.yaml` file uses pip to install the package during the build process. Basically, conda-build runs the normal Python installer, figures out which files that installs, and then packages up those files into a conda package. It looks like you might need to investigate which extra dependencies are installed by including the `[cli]` option when you `pip install python-dotenv`. Basically, open `setup.py` and look at the `extras_require` list. Then add those dependencies to `meta.yaml`. – darthbith Feb 16 '20 at 04:19
  • I did peek into `python-dotenv/meta.yaml` and found the line `script: "{{ PYTHON }} -m pip install . -vv" ` But I have no idea how to add the [cli] option to that. I tried adding the string after the dot, or in various other places on that line and none of them worked. – Randy Poe Feb 18 '20 at 22:02
  • I'm hesitant to do `pip install python-dotenv[cli]` directly from the command line because of what I've read about how that screws up conda's bookkeeping... Ah, I see what you're saying. Basically to manually duplicate what the [cli] option does. I can try your suggestion. – Randy Poe Feb 18 '20 at 22:04
  • Yep, that's exactly it, you've got to manually duplicate what Pip does automatically when you add the `[cli]` option. This is managed in `setup.py` by the dict called `extras_require`. – darthbith Feb 18 '20 at 23:34
  • I found this: `extras_require={ 'cli': ['click>=5.0', ],},` So should I be adding 'click >= 5.0' to my meta.yaml? Additional data: I tried running `pip install python-dotenv[cli]`. It ran successfully and reported no errors. But then when I tried to build ibm-watson it told me it needed to install python-dotenv, which then failed on the CLI test again. – Randy Poe Feb 19 '20 at 01:09
  • All right, with your help I think I got it to succeed, though there are still things I don't understand. I added the click requirement to `ibm-watson/meta.yaml`. I commented out any reference to `python-dotenv`, built built it separately with pip and the [cli] option. The build worked successfully. It failed at first, telling me something was wrong with my '>=' on the click requirement. I deleted the line, copied an existing line and edited it to say `click >=5.0`. I have no idea why that succeeded. – Randy Poe Feb 19 '20 at 01:24
  • `Error: bad character '>=' in package version dependency 'click' Perhaps you meant 'click >=5.0'` As that is exactly what I appear to have typed, I have no idea what created this error. – Randy Poe Feb 19 '20 at 01:26
  • It's possible there's some Unicode character in there that you can't see but which was copied from wherever you copied the specification. Rather than adding the `click` dependency to `ibm-watson`, you should build a package for `python-dotenv` (but check first if one exists by searching on Anaconda.org) that includes the proper dependency. – darthbith Feb 20 '20 at 16:36

0 Answers0