[question] export-pkg: specify the 'user' and the 'channel' or neither of them

See original GitHub issue

I’m developing a conan package for my own header-only library and I get this error:

$ conan export-pkg . -sf ./tmp/src -bf ./tmp/build
ERROR: Specify the 'user' and the 'channel' or neither of them

I tried to explicitly pass the reference to export-pkg as:

  • demo/testing;
  • bitmask_enum/0.0.1@;
  • bitmask_enum/0.0.1@demo/testing;
  • bitmask_enum/0.0.1@/.

None of the above worked.

I’m running version 1.46.2 on Windows 10 Pro, installed through the windows installer (did not try pip). I get the same error both with:

  • mintty 3.5.3 (x86_64-pc-msys) [Windows 19042];
  • Power Shell.

The full script I run to test my conan package is the following:

#!/bin/sh

typeset -r conan_root=tmp
typeset -r src_folder=${conan_root}/src
typeset -r inst_folder=${conan_root}/instal
typeset -r build_folder=${conan_root}/build
typeset -r pkg_folder=${conan_root}/pkg

rm -rvf tmp/*

echo "> conan source"
conan source  . \
    --source-folder "$src_folder" \
    || exit 1

echo "> conan install"
conan install . \
    --install-folder "$inst_folder" \
    || exit 1

echo "> conan build"
conan build . \
    --install-folder "$inst_folder" \
    --build-folder "$build_folder" \
    || exit 1

echo "> conan package"
conan package . \
    --source-folder "$src_folder" \
    --install-folder "$inst_folder" \
    --build-folder "$build_folder" \
    --package-folder "$pkg_folder" \
    || exit 1

echo "> conan export-pkg"
conan export-pkg . \
    --source-folder "$src_folder" \
    --build-folder "$build_folder" \
    || exit 1

echo "> conan test"
cnonan test test_package bitmask_enum/0.0.1@ \
    || exit 1

My configuration is:

[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=16
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

I’ve read through issues #7568 and #479 but neither seems relevant to my case. The only post I found on stackoveflow recommends upgrading conan: upgrading it did not solve my issue.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pdigigliocommented, Mar 30, 2022

Have you tried to wipe your cache? You can try removing the <username>/.conan folder, and repeat. Maybe something is corrupted in the cache or in the cache configuration (if you plan to do this, it would be good to do a backup of the .conan folder, for later inspection if needed)

That was the solution, thanks a lot. I would have never thought about this myself. After renaming my cache folder, I ran conan create . and everything works.

By comparing the newly created <username>/.conan with the old one, I realized the problem is setting storage.path in conan.conf. I had changed it since I was exhausting my C:\ drive:

# File: <username>/.conan/conan.conf

# ...

[storage]
# (default) Relative path to a folder in C:\
#path = ./data

# Absolute path to a folder in D:\
path = D:\conan_packages

If I restore path = ./data, both conan create and conan export-pkg work as expected.

The issue seems to be due to specifying a storage.path that’s a top-level folder of drive D:\. I tried all of these:

[storage]
## This fails
#path = D:\conan_packages

## This fails
#path = D:/conan_packages

## This fails
#path = D:\\conan_packages

# This works
path = D:\test\conan

This is kind of weird to me as I’ve been able to create my own packages in D:\conan_packages in the past.

If you consider this to be a bug that’s worth investigating, I can provide more information. As far as I’m concerned, I can carry on with changing my storage.path to a non top-level folder of D:\.

Thanks a lot for your help.

0reactions
memshardedcommented, Jul 20, 2022

Thanks for the feedback @UtkarshVerma37051. Just a couple of notes:

  • Conan 2.0 actually allows to define only the user, but not the channel
  • Conan 2.0 will not have this issue, as the cache will have a different layout.
  • Please be aware that renaming user/channel is not a good practice anymore. Conan 2.0 has removed the conan copy command that allowed this, and trying to manually rename packages renaming folders will not be possible either.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask Question - Stack Overflow
ERROR: Specify the 'user' and the 'channel' or neither of them . It doesn't make any difference if I remove both user and...
Read more >
[bug] most commands fail with "Specify the 'user' and ... - GitHub
[bug] Error: Specify the 'user' and the 'channel' or neither of them when using version ranges #11764 · [question] export-pkg: specify the 'user...
Read more >
conan export-pkg — conan 1.36.0 documentation
The export-pkg command let you create a package from already existing files in your working folder, it can be useful if you are...
Read more >
Conan packages in the Package Registry - GitLab Docs
Publish Conan packages in your project's Package Registry. Then install the packages whenever you need to use them as a dependency.
Read more >
Writing R Extensions - The Comprehensive R Archive Network
Next: Configure and cleanup, Previous: Creating R packages, Up: Creating R ... in the package should be exported to make them available to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found