Closed bollwyvl closed 8 years ago
I haven't been able to reproduce this error with a local notebook... but then, I also don't know what attaching an environment actually buys you, as I don't see it surfaced anywhere in the UI.
Doing a standalone anaconda upload
of an environment.yml
creates something that looks like a package:
nbollweg@rocinante:~/Documents/projects/nb_anacondacloud (nb42beta)$ anaconda upload environment.yml
Using Anaconda Cloud api site https://api.anaconda.org
detecting package type ...
env
extracting package attributes for upload ...
done
Uploading file nbcio/nb_anacondacloud/2016.04.20.1234/environment.yml ...
uploaded 2 of 2Kb: 100.00% ETA: 0.0 minutes
Upload(s) Complete
Package located at:
https://anaconda.org/nbcio/nb_anacondacloud
Whereas trying to download a notebook with an attached env:
nbollweg@rocinante:~/Documents/projects/nb_anacondacloud (nb42beta)$ anaconda download nbcio/untitled
Using Anaconda Cloud api site https://api.anaconda.org
nbcio/untitled has been downloaded as untitled-ipynb.
untitled-ipynb has an environment embedded.
Run:
conda env create untitled-ipynb
To install the environment in your system
This creates a file, untitled-ipynb
(which the notebook won't even open, as it doesn't have a file type). So that's weird.
If you do conda env create untitled-ipynb
, it starts getting even stranger:
nbollweg@rocinante:~/Documents/projects/nb_anacondacloud (nb42beta)$ conda env create untitled-ipynb
Using Anaconda Cloud api site https://api.anaconda.org
#
# To activate this environment, use:
# $ source activate python3
#
# To deactivate this environment, use:
# $ source deactivate
#
nbollweg@rocinante:~/Documents/projects/nb_anacondacloud (nb42beta)$
nbollweg@rocinante:~/Documents/projects/nb_anacondacloud (nb42beta)$ source activate python3
Error: could not find environment: python3
So we need to decide what we actually want it to do, which will likely address this issue :) I'll spread some more issue :heart: and see if we get some bites...
@bollwyvl I think you should use conda env to upload environment to anaconda.org: http://envs.anaconda.org/
Was able to reproduce this with nb_conda_kernels
installed... this of course after doing all my beta builds.
Here is the problem line:
ERROR:nb_anacondacloud.uploader:Command '['conda', 'env', 'export', '-n', 'Python', '[foo]']' returned non-zero exit sta tus 2
So we just need to be cleverer about how nb_anacondacloud works with the metadata in the notebook... or be cleverer about how nb_conda_kernels
populates the metadata.
Here is the full log:
Using Anaconda Cloud api site https://api.anaconda.org
usage: conda-env-script.py [-h]
{attach,create,export,list,remove,upload,update}
...
conda-env-script.py: error: unrecognized arguments: [foo]
ERROR:nb_anacondacloud.uploader:Command '['conda', 'env', 'export', '-n', 'Python', '[foo]']' returned non-zero exit sta
tus 2
[E 10:19:25.720 NotebookApp] Uncaught exception POST /anaconda-cloud/publish (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/anaconda-cloud/publish', version='HTT
P/1.1', remote_ip='::1', headers={'Content-Length': '1323', 'Accept-Language': 'en-US,en;q=0.5', 'Accept-Encoding': 'gzi
p, deflate', 'Host': 'localhost:8888', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'User-Agent': 'Mozill
a/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0', 'Connection': 'keep-alive', 'X-Requested-With': 'XM
LHttpRequest', 'Referer': 'http://localhost:8888/notebooks/Untitled4.ipynb?kernel_name=Python%20[foo]', 'Content-Type':
'application/json; charset=utf-8'})
Traceback (most recent call last):
File "C:\cnda\envs\foo\lib\site-packages\tornado\web.py", line 1443, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "C:\cnda\envs\foo\lib\site-packages\tornado\web.py", line 2800, in wrapper
return method(self, *args, **kwargs)
File "C:\cnda\envs\foo\lib\site-packages\nb_anacondacloud\handlers.py", line 56, in post
self.finish(json.dumps(uploader.upload()))
File "C:\cnda\envs\foo\lib\site-packages\nb_anacondacloud\uploader.py", line 44, in upload
self.content_io(),
File "C:\cnda\envs\foo\lib\site-packages\nb_anacondacloud\uploader.py", line 73, in content_io
self.content = self.attach_env(self.content)
File "C:\cnda\envs\foo\lib\site-packages\nb_anacondacloud\uploader.py", line 57, in attach_env
self._exec('conda env export -n {}'.format(self.env_name))
File "C:\cnda\envs\foo\lib\site-packages\yaml\__init__.py", line 69, in load
loader = Loader(stream)
File "C:\cnda\envs\foo\lib\site-packages\yaml\loader.py", line 34, in __init__
Reader.__init__(self, stream)
File "C:\cnda\envs\foo\lib\site-packages\yaml\reader.py", line 85, in __init__
self.determine_encoding()
File "C:\cnda\envs\foo\lib\site-packages\yaml\reader.py", line 124, in determine_encoding
self.update_raw()
File "C:\cnda\envs\foo\lib\site-packages\yaml\reader.py", line 178, in update_raw
data = self.stream.read(size)
AttributeError: 'dict' object has no attribute 'read'
[E 10:19:25.733 NotebookApp] {
"Content-Length": "1323",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate",
"Host": "localhost:8888",
"Accept": "application/json, text/javascript, */*; q=0.01",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0",
"Connection": "keep-alive",
"X-Requested-With": "XMLHttpRequest",
"Referer": "http://localhost:8888/notebooks/Untitled4.ipynb?kernel_name=Python%20[foo]",
"Content-Type": "application/json; charset=utf-8"
}
[E 10:19:25.736 NotebookApp] 500 POST /anaconda-cloud/publish (::1) 1318.00ms referer=http://localhost:8888/notebooks/Un
titled4.ipynb?kernel_name=Python%20[foo]
So we just need to be cleverer about how nb_anacondacloud works with the metadata in the notebook... or be cleverer about how nb_conda_kernels populates the metadata.
I would probably go with the first option... but the second one seems interesting as well.
Fixed with v1.0.0, by way of #21!
Moved from https://github.com/ContinuumIO/anaconda-nb-extensions-meta-config/issues/2
By @mrduane: