conda / constructor

tool for creating installers from conda packages
https://conda.github.io/constructor/
Other
457 stars 167 forks source link

`conda --clone` surprised me by downloading a stack of files #145

Closed kalefranz closed 3 years ago

kalefranz commented 6 years ago

From @ijstokes on September 12, 2017 15:57

TL;DR: I expect conda --clone to benefit from the fact that all the necessary files for the clone environment are already on my system, and nothing needs to be downloaded. But that does not seem to be the case.

Details:

I'm trying to clone my base environment. Meaning I want an exact clone of my base environment ( understanding some packages can, at this point, only exist in the base environment and so they won't be in the clone). Worst case scenario the clone will be a subset of what is in my base environment, which I would take to mean that all the bytes related to the clone are already on my system. So it is a surprise when this operation triggers a download of basically everything I have.

$ conda create -n root_clone --clone root
Source:      /Users/ijstokes/anaconda
Destination: /Users/ijstokes/anaconda/envs/root_clone
The following packages cannot be cloned out of the root environment:
 - conda-4.4.0rc1-py36_0
 - conda-build-3.0.6-py36_0
 - conda-env-2.6.0-0
Packages: 370
Files: 344

Downloading and Extracting Packages
blosc 1.2.3: ###################################################################################################################### | 100% 
ca-certificates 2017.7.27.1: ###################################################################################################### | 100% 
expat 2.1.0: ###################################################################################################################### | 100% 
font-ttf-dejavu-sans-mono 2.37: ################################################################################################### | 100% 
font-ttf-inconsolata 2.000: ####################################################################################################### | 100% 
font-ttf-source-code-pro 2.030: ################################################################################################### | 100% 
font-ttf-ubuntu 0.83: ############################################################################################################# | 100% 
graphite2 1.3.9: ################################################################################################################## | 100% 
icu 54.1: ######################################################################################################################### | 100% 
jbig 2.1: ######################################################################################################################### | 100% 
jpeg 9b: ########################################################################################################################## | 100% 
libffi 3.2.1: ##################################################################################################################### | 100% 
libgcc 4.8.5: ##################################################################################################################### | 100% 
libgpuarray 0.6.8: ################################################################################################################ | 100% 
libiconv 1.14: #################################################################################################################### | 100% 
mkl 2017.0.3:                                                                                                                       |   0% mkl 2017.0.3: ##################################################################################################################### | 100% 
ncurses 5.9: ###################################################################################################################### | 100% 
openjdk 8.0.121: ################################################################################################################## | 100% 
pixman 0.34.0: #################################################################################################################### | 100% 
readline 6.2: ##################################################################################################################### | 100% 
redis 3.2.0: ###################################################################################################################### | 100% 
sqlite 3.13.0: #################################################################################################################### | 100% 
tk 8.5.18: ######################################################################################################################## | 100% 
unixodbc 2.3.4: ################################################################################################################### | 100% 
xz 5.2.2: ######################################################################################################################### | 100% 
yaml 0.1.6: ####################################################################################################################### | 100% 
zeromq 4.1.3: ##################################################################################################################### | 100% 
zlib 1.2.8: ####################################################################################################################### | 100% 
dbus 1.10.10: ##################################################################################################################### | 100% 
fonts-continuum 1: ################################################################################################################ | 100% 
gettext 0.19.8: ################################################################################################################### | 100% 
gsl 2.2.1: ######################################################################################################################## | 100% 
h2o 3.10.0.9: ##################################################################################################################### | 100% 
hdf5 1.8.17: ###################################################################################################################### | 100% 
libpng 1.6.27: #################################################################################################################### | 100% 
libprotobuf 3.2.0: ################################################################################################################ | 100% 
libtiff 4.0.6: #################################################################################################################### | 100% 
libxml2 2.9.4: #################################################################################################################### | 100% 
openssl 1.0.2l: ################################################################################################################### | 100% 
pandoc 1.19.2.1: ################################################################################################################## | 100% 
pcre 8.39: ######################################################################################################################## | 100% 
qt 5.6.2: ######################################################################################################################### | 100% 
curl 7.52.1: ###################################################################################################################### | 100% 
freetype 2.5.5: ################################################################################################################### | 100% 
glib 2.50.2: ###################################################################################################################### | 100% 
libxslt 1.1.29: ################################################################################################################### | 100% 
python 3.6.1: ##################################################################################################################### | 100% 
_license 1.1: ##################################################################################################################### | 100% 
alabaster 0.7.10: ################################################################################################################# | 100% 
anaconda custom: ################################################################################################################## | 100% 
appnope 0.1.0: #################################################################################################################### | 100% 
appscript 1.0.1: ################################################################################################################## | 100% 
asn1crypto 0.22.0: ################################################################################################################ | 100% 
backports 1.0: #################################################################################################################### | 100% 
beautifulsoup4 4.6.0: ############################################################################################################# | 100% 
bitarray 0.8.1: ################################################################################################################### | 100% 
blist 1.3.6: ###################################################################################################################### | 100% 
boto 2.47.0: ###################################################################################################################### | 100% 
certifi 2016.2.28: ################################################################################################################ | 100% 

You get the idea!

$ conda info -a

     active environment : base
    active env location : /Users/ijstokes/anaconda
            shell level : 1
       user config file : /Users/ijstokes/.condarc
 populated config files : /Users/ijstokes/anaconda/.condarc
                          /Users/ijstokes/.condarc
          conda version : 4.4.0rc1
    conda-build version : 3.0.6
         python version : 3.6.1.final.0
       base environment : /Users/ijstokes/anaconda  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.continuum.io/pkgs/free/osx-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/osx-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/osx-64
                          https://repo.continuum.io/pkgs/pro/noarch
          package cache : /Users/ijstokes/anaconda/pkgs
                          /Users/ijstokes/.conda/pkgs
       envs directories : /Users/ijstokes/anaconda/envs
                          /Users/ijstokes/.conda/envs
               platform : osx-64
             user-agent : conda/4.4.0rc1 requests/2.14.2 CPython/3.6.1 Darwin/16.7.0 OSX/10.12.6
                UID:GID : 502:20
             netrc file : None
           offline mode : False

# conda environments:
#
ana44clean               /Users/ijstokes/anaconda/envs/ana44clean
ana44scan                /Users/ijstokes/anaconda/envs/ana44scan
ap-features              /Users/ijstokes/anaconda/envs/ap-features
bokehwkshp               /Users/ijstokes/anaconda/envs/bokehwkshp
car-behavioral-cloning     /Users/ijstokes/anaconda/envs/car-behavioral-cloning
cpuc                     /Users/ijstokes/anaconda/envs/cpuc
daskwkshp                /Users/ijstokes/anaconda/envs/daskwkshp
dspyr                    /Users/ijstokes/anaconda/envs/dspyr
fusion                   /Users/ijstokes/anaconda/envs/fusion
ggpy36                   /Users/ijstokes/anaconda/envs/ggpy36
h2o                      /Users/ijstokes/anaconda/envs/h2o
ingest                   /Users/ijstokes/anaconda/envs/ingest
jlab                     /Users/ijstokes/anaconda/envs/jlab
jupyter                  /Users/ijstokes/anaconda/envs/jupyter
myenv                    /Users/ijstokes/anaconda/envs/myenv
myoracle                 /Users/ijstokes/anaconda/envs/myoracle
myoracle60py36           /Users/ijstokes/anaconda/envs/myoracle60py36
mytest                   /Users/ijstokes/anaconda/envs/mytest
opensky                  /Users/ijstokes/anaconda/envs/opensky
oracle                   /Users/ijstokes/anaconda/envs/oracle
py27                     /Users/ijstokes/anaconda/envs/py27
py27scan                 /Users/ijstokes/anaconda/envs/py27scan
py36                     /Users/ijstokes/anaconda/envs/py36
spark                    /Users/ijstokes/anaconda/envs/spark
spyder                   /Users/ijstokes/anaconda/envs/spyder
topher                   /Users/ijstokes/anaconda/envs/topher
vatic                    /Users/ijstokes/anaconda/envs/vatic
webex                    /Users/ijstokes/anaconda/envs/webex
base                  *  /Users/ijstokes/anaconda

sys.version: 3.6.1 |Anaconda custom (x86_64)| (defaul...
sys.prefix: /Users/ijstokes/anaconda
sys.executable: /Users/ijstokes/anaconda/bin/python
conda location: /Users/ijstokes/anaconda/lib/python3.6/site-packages/conda
conda-build: /Users/ijstokes/anaconda/bin/conda-build
conda-convert: /Users/ijstokes/anaconda/bin/conda-convert
conda-develop: /Users/ijstokes/anaconda/bin/conda-develop
conda-env: /Users/ijstokes/anaconda/bin/conda-env
conda-index: /Users/ijstokes/anaconda/bin/conda-index
conda-inspect: /Users/ijstokes/anaconda/bin/conda-inspect
conda-metapackage: /Users/ijstokes/anaconda/bin/conda-metapackage
conda-render: /Users/ijstokes/anaconda/bin/conda-render
conda-server: /Users/ijstokes/anaconda/bin/conda-server
conda-skeleton: /Users/ijstokes/anaconda/bin/conda-skeleton
conda-verify: /Users/ijstokes/anaconda/bin/conda-verify
user site dirs: 

CONDA_DEFAULT_ENV: base
CONDA_ENVS_PATH: <not set>
DYLD_LIBRARY_PATH: <not set>
PATH: /Users/ijstokes/anaconda/bin:/Users/ijstokes/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
PYTHONHOME: <not set>
PYTHONPATH: <not set>

License directories:
    /Users/ijstokes/.continuum
    /Users/ijstokes/Library/Application Support/Anaconda
    /Users/ijstokes/anaconda/licenses
License files (license*.txt):
    /Users/ijstokes/.continuum/license_bundle_20160524191753.txt
               Reading license file : 6
                    Signature valid : 6
                       Vendor match : 3
                            product : 'mkl-optimizations'
                           packages : 'mkl'
                           end_date : '2017-05-24'
                               type : 'Trial'
                            product : 'iopro'
                           packages : 'iopro'
                           end_date : '2017-05-24'
                               type : 'Trial'
                            product : 'accelerate'
                           packages : 'numbapro mkl'
                           end_date : '2017-05-24'
                               type : 'Trial'
    /Users/ijstokes/.continuum/license_fusion_20161026132253.txt
               Reading license file : 1
                    Signature valid : 1
                       Vendor match : 0
Package/feature end dates:
    mkl             : 2017-05-24
    iopro           : 2017-05-24
    numbapro        : 2017-05-24

Copied from original issue: conda/conda#5953

kalefranz commented 6 years ago

From @ijstokes on September 12, 2017 16:9

I wonder if this is related to #4138

kalefranz commented 6 years ago

From @ijstokes on September 12, 2017 16:45

I am wondering if conda is somehow exactly tracking the source of packages in the environment I am cloning from, including the auth token that was used at that time to fetch the particular package. And then the --clone tries to use those exact package source URLs, including the auth token.

In the event the auth token is expired or has been rescinded this is going to create problems (if it is how things work). In any case the --clone operation, given it could be that Bob wants to clone Alice's environment, should probably not include those auth tokens in any permanent record of "where to get the package" (related to https://github.com/Anaconda-Platform/anaconda-server/issues/1304)

kalefranz commented 6 years ago

This is actually an issue with constructor. It's maybe partially related to https://github.com/conda/constructor/issues/138. But there's also probably more to it.

I'm going to move this over to the constructor tracker now.

lanrete commented 6 years ago

Any update on the issue? Met the same problem today.

robgics commented 6 years ago

Same here.

I encountered this clone/downloading issue when using conda from Anaconda 5.1.0. I know that I did not have this issue when using Anaconda 5.0.1 because I wrote a detailed process for building a particular piece of software that involved the --clone procedure and worked without downloading any packages. So, I went back to Anaconda 5.0.1....and now it ALSO downloads packages. I cannot revert back to it working the way it used to it seems.

Edit: Ok, I retract some of that. Basically, I'm switching back and forth between 5.0.1 and 5.1.0 usage while I try some things, and I have now found that if I remove 5.1.0, delete the ~/.conda dir, and (most importantly) close the shell and open a new one....then I can once again use conda from Anaconda 5.0.1 to create a new environment with --clone, and it does not download anything. In other words, it is working again like before. That is good.

The issue remains with 5.1.0 that trying to clone the install directory for Anaconda 5.1.0 when making a new conda environment causes it to try to download everything.

nehaljwani commented 6 years ago

@robgics Do you face the same issue with Anaconda 5.2.0 ?

mbargull commented 6 years ago

Did a quick test: This is a conda issue -- not sure if entirely, but at least partially. @robgics: Did you by any change run conda clean --tarballs (or --all) before running conda create --clone? I haven't looked at the code yet, but testing revealed that --clone does not use the cached packages if their tarballs are removed. I'll open up an issue for conda.

mbargull commented 6 years ago

xref: https://github.com/conda/conda/issues/7398

mbargull commented 6 years ago

This is a conda issue -- not sure if entirely, but at least partially.

Not entirely, apparently: https://github.com/conda/constructor/issues/203 https://github.com/conda/conda/issues/7398#issuecomment-395939637

robgics commented 6 years ago

Sorry, was away for the week.

I just tried Anaconda 5.2.0 and saw the same issue....cloning caused downloading of all packages.

@mbargull No, I know I didn't do that because I really have never run "conda clean". I typically just delete ~/.conda* before doing something new as a way to reset my system. Perhaps that's not a good idea...? I have confirmed that in the cloned dir pkgs there are all of the .tar.bz2 files that should be there.

robgics commented 6 years ago

Not sure if it helps, but on a clean system, I don't see the problem when using conda 4.3.30, and I do when using conda 4.4.10.

mforbes commented 6 years ago

Is there a workaround for this? I am working on a fairly limited server without the ability to modify the base environment and clone downloads so much stuff that I run out of space.

lanrete commented 6 years ago

To provide some update on this one, hope might help for the issue.

I use the same conda version on both my work laptop and my PC at home. For my PC at home, conda didn't run into such problems. I'm pretty sure the configuration are the same, the differences might be that I don't have full admin access on my work laptop.

mcg1969 commented 3 years ago

Sorry for the form letter here—I'm doing some issue cleanup right now and closing out some stale issues. Constructor 3.x was a significant rewrite, and so many of the issues filed before its release would need to be re-tested / re-verified. If you have good reason to believe this still needs to be addressed in 3.x, please feel free to re-open or file a new issue with additional information on how to reproduce the issue on the latest versions of constructor.

NOTE: Heck I don't even understand why this is a constructor issue and not a conda issue.

github-actions[bot] commented 2 years ago

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!