juju-solutions / layer-caas-base

Base layer for CaaS charms
Apache License 2.0
2 stars 7 forks source link

ImportError: cannot import name 'SourceDistribution' #25

Open davigar15 opened 4 years ago

davigar15 commented 4 years ago

I'm having the following issue to build a k8s charm

$ charm build . --force build: Conflict: File in destination directory was modified after charm build: tests/resources/mysql-image.yaml build: Conflict: File in destination directory was modified after charm build: lib/charms/layer/caas_base.py build: Continuing with known changes to target layer. Changes will be overwritten build: Destination charm directory: /home/davigar15/code/charms/builds/mariadb-k8s build: Processing layer: layer:options build: Processing layer: layer:caas-base build: Processing layer: layer:status build: Processing layer: layer:docker-resource build: Processing layer: layer:osm-common (from ../osm-common) build: Processing layer: mariadb-k8s (from .) build: Processing interface: mysql (from ../canonical-osm/charms/interfaces/juju-relation-mysql) WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. Traceback (most recent call last): File "/snap/charm/397/bin/pip3", line 11, in sys.exit(main()) File "/home/davigar15/.local/lib/python3.6/site-packages/pip/_internal/init.py", line 18, in main return _wrapper(args) File "/home/davigar15/.local/lib/python3.6/site-packages/pip/_internal/utils/entrypoints.py", line 31, in _wrapper return main(args) File "/home/davigar15/.local/lib/python3.6/site-packages/pip/_internal/cli/main.py", line 73, in main command = create_command(cmd_name, isolated=("--isolated" in cmd_args)) File "/home/davigar15/.local/lib/python3.6/site-packages/pip/_internal/commands/init.py", line 96, in create_command module = importlib.import_module(module_path) File "/snap/charm/397/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/davigar15/.local/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 24, in from pip._internal.cli.req_command import RequirementCommand File "/home/davigar15/.local/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 20, in from pip._internal.operations.prepare import RequirementPreparer File "/home/davigar15/.local/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 16, in from pip._internal.distributions import ( File "/home/davigar15/.local/lib/python3.6/site-packages/pip/_internal/distributions/init.py", line 1, in from pip._internal.distributions.source import SourceDistribution ImportError: cannot import name 'SourceDistribution'

Command failed: pip3 install -t /tmp/tmp730ut_gb -r /home/davigar15/.cache/charm/24661/layer/caas-base/wheelhouse.txt

svenhaile commented 4 years ago

If you are using pip 0.20.0, you can up/downgrade the pip version using the instructions here or in the related links: https://stackoverflow.com/questions/59842600/importerror-cannot-import-name-sourcedistribution-from-pip-internal-distrib