vc 74
vc 74

Reputation: 38179

Conda custom channel on windows

I've created a custom channel on a windows box following the steps detailed here.

Now I'd like to access it from a different machine but the channel parameter is a URI and I don't know what form it should take with Windows.

Here's the command I tried to execute:

conda search -c file://machine\C\channel --override-channels scipy

which failed with the following error message:

Fetching package metadata: Error: Invalid index file

Upvotes: 5

Views: 4387

Answers (5)

Mike Davies
Mike Davies

Reputation: 51

If your conda channel is at C:\conda-channel then do:

conda search -c file://\conda-channel --override-channels

There is currently a bug in conda 4.6+ where file://C:\conda-channel will not work as it removes the colon when parsing. And downgrading to 4.5 is dangerous and can mess up your installation.

Upvotes: 0

Steven C. Howell
Steven C. Howell

Reputation: 18584

I had no success with the other answers though @gDexter42 helped me in the right direction. Perhaps the API has changed. Testing several different options I was somewhat surprised that

  • you can use / or \ interchangably
  • you do not need to escape spaces
  • you do not need to enclose paths with spaces in quotes

After creating a custom channel in a network accessible directory, you can search for a conda package using the file path, excluding the file:// mentioned in other posts and in the documentation.

For a UNC Path:

$ conda search -c //my_nas/some/path with spaces/channel --override-channels

or $ conda search -c \my_nas\some\path with spaces\channel --override-channels

If the folder is local, or you have mounted a network directory to a local path (D:\ in this example), you would use that file path.

$ conda search -c D:/some/path with spaces/channel --override-channels 

or

$ conda search -c D:\some\path with spaces\channel --override-channels 

I tested these commands using both Git Bash for Windows and Anaconda Prompt (which I think is just cmd.exe with the path modified so base/root is the active environment).

Note that if you then want to add that path to your .condarc file, you can use the same path.

channels: - \\my_nas\some\path with spaces\channel # UNC - D:/some/path with spaces/channel # local drive - defaults # this gives defaults lower priority ssl_verify: true

Upvotes: 3

gDexter42
gDexter42

Reputation: 177

If you are trying to search for a conda package in a local directory (not on UNC), the following two approaches worked for me.

  1. Navigate to the drive containing the package and try

conda search -c file://folder_path/channel --override-channels

  1. the better way is to drop the file flag which allows you to search from any drive. Type

conda search -c Drive://folder_path/channel --override-channels thus if you are searching from D: drive you would type this as conda search -c D://folder_path/channel --override-channels

Upvotes: 1

Janus
Janus

Reputation: 5681

I have been trying to do the same thing, and the answer by Paul made me a bit pessimistic.

It turns out that it is possible to use a UNC-path. After trying a few hundred combinations of slashes and backslashes, I found this combination to work:

conda search -c "file://\\DOMAIN\SERVER\SHARE\conda\channel" --override-channels

Similarly,

conda config --add channels "file://\\DOMAIN\SERVER\SHARE\conda\channel"

Adds the channel to your config file.

Upvotes: 5

Paul
Paul

Reputation: 5935

Let's say that your custom channel is located in the following directory: N:\conda\channel. Then we would expect to see the following in this directory (1) the win-64 directory (2) the index files inside, in this case the directory N:\conda\channel\win-64\, of repodata.json and repodata.json.bz2 (3) any packages that you have added to your channel. A search on this channel for the scipy package, ignoring all other channels, would look like this conda search -c file://N:\conda\channel --override-channels scipy

Did you add the scipy package into your custom channel? If you did, then did you run conda index on that directory?

I'm a little confused by your directory structure but, if your channel is machine\C\channel, then what happens when you do dir machine\C\channel?

Upvotes: 3

Related Questions