Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conda-forge based CI #133

Merged
merged 38 commits into from
Mar 7, 2023
Merged

Add conda-forge based CI #133

merged 38 commits into from
Mar 7, 2023

Conversation

jaimergp
Copy link
Contributor

@jaimergp jaimergp commented Feb 10, 2023

Description

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

Comes from #120, using conda/conda#12335

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Feb 10, 2023
@jaimergp
Copy link
Contributor Author

Needs changes in conda/conda#12350

@jaimergp
Copy link
Contributor Author

jaimergp commented Feb 22, 2023

@costrouc I'll need some help debugging the errors in tests/test_create.py::IntegrationTests::test_conda_pip_interop_conda_editable_package. Maybe we can pair-debug this one? I cannot reproduce locally (it passes), so I wonder if it has to do with this change.

@costrouc costrouc mentioned this pull request Feb 27, 2023
@costrouc
Copy link
Contributor

costrouc commented Feb 27, 2023

I can reproduce this test with the following locally (am running on a x86 machine in the unlikely case this would be why @jaimergp could not reproduce it).

docker run --rm -it \
       -v /home/costrouc/p/conda/conda:/opt/conda-src \
       -v /home/costrouc/p/conda/conda-libmamba-solver:/opt/conda-libmamba-solver-src \
       -e TEST_SPLITS=3 \
       -e TEST_GROUP=1 \
       -e CONDA_SOLVER=libmamba \
       ghcr.io/conda/conda-ci:main-linux-python3.10-conda-forge \
       bash

Then running

sudo env CONDA_SOLVER=classic /opt/conda/condabin/conda install -p /opt/conda --file /opt/conda-libmamba-solver-src/dev/requirements.txt
/opt/conda/bin/python -m pip install /opt/conda-libmamba-solver-src --no-deps -vvv
source /opt/conda-src/dev/linux/integration.sh

I am next going to try to narrow this down.

@costrouc
Copy link
Contributor

costrouc commented Feb 27, 2023

Okay can reproduce with a single test.

sudo env CONDA_SOLVER=classic /opt/conda/condabin/conda install -p /opt/conda --file /opt/conda-libmamba-solver-src/dev/requirements.txt
/opt/conda/bin/python -m pip install /opt/conda-libmamba-solver-src --no-deps -vvv

# taken from dev/linux/integration.sh
git config --global --add safe.directory /opt/conda-src
sudo su root -c "/opt/conda/bin/conda install -yq conda-build"
sudo /opt/conda/bin/conda install --quiet -y --file tests/requirements.txt
eval "$(sudo /opt/conda/bin/python -m conda init --dev bash)"
conda-build tests/test-recipes/activate_deactivate_package tests/test-recipes/pre_link_messages_package
conda info
export TMP=$HOME/pytesttmp
mkdir -p $TMP

# run single test
pytest tests/test_create.py::IntegrationTests::test_conda_pip_interop_conda_editable_package

From the docker image. FAILED tests/test_create.py::IntegrationTests::test_conda_pip_interop_conda_editable_package - RuntimeError: Cannot unlink unmanageable packages:

The logs are attached logs.txt

@costrouc
Copy link
Contributor

costrouc commented Feb 27, 2023

When using pdb I was able to extract some of the state around the failure.

(Pdb) unlink_precs
IndexedSet([PrefixRecord(_hash=919153346818182340, name='urllib3', version='1.19.1', build='dev_0', build_number=0, channel=Channel("<develop>"), subdir='pypi', depends=('python 2.7.*',), constrains=('cryptography >=1.3.4', 'idna >=2.0.0', 'pyopenssl >=0.14', 'pysocks !=1.5.7,<2.0,>=1.5.6'), package_type='virtual_python_egg_link', files=(), paths_data=PathsData(paths_version=1, paths=()))])
(Pdb) link_precs
IndexedSet([PackageRecord(_hash=6144791784308069146, name='urllib3', version='1.20', build='py27_1', build_number=1, channel=Channel("conda-forge/linux-64"), subdir='linux-64', fn='urllib3-1.20-py27_1.tar.bz2', md5='0507cc609938ad8fc81c18f818b80f52', url='https://conda.anaconda.org/conda-forge/linux-64/urllib3-1.20-py27_1.tar.bz2', sha256='139f41180aebfbb75161e313daecc29bd34c5b914ac27948e6ba62d7ae8ab2ca', depends=('python 2.7*',), constrains=('python_abi * *_cp27mu',), track_features=(), license='MIT', timestamp=0, size=130718)])
(Pdb) unlink_precs[0]
PrefixRecord(_hash=919153346818182340, name='urllib3', version='1.19.1', build='dev_0', build_number=0, channel=Channel("<develop>"), subdir='pypi', depends=('python 2.7.*',), constrains=('cryptography >=1.3.4', 'idna >=2.0.0', 'pyopenssl >=0.14', 'pysocks !=1.5.7,<2.0,>=1.5.6'), package_type='virtual_python_egg_link', files=(), paths_data=PathsData(paths_version=1, paths=()))
(Pdb) unlink_precs[0].is_unmanageable
True
(Pdb) unlink_precs[0].package_type
<PackageType.VIRTUAL_PYTHON_EGG_LINK: 'virtual_python_egg_link'>
(Pdb) from conda.models.enums import PackageType
(Pdb) unlink_precs[0].package_type in PackageType.unmanageable_package_types()
True
(Pdb) self.specs_to_add
IndexedSet([MatchSpec("urllib3=1.20")])
(Pdb) self.prefix
'/home/test_user/pytesttmp/0b0a abdecf'
(Pdb) os.listdir(self.prefix + '/lib/python2.7/site-packages/')
['certifi-2020.6.20-py3.6.egg-info', 'README', 'urllib3.egg-link', 'wheel-0.37.1-py3.9.egg-info', 'setuptools-44.0.0.post20200106-py2.7.egg-info', 'wheel', 'pip-10.0.1-py2.7.egg-info', 'setuptools', 'easy-install.pth', 'pkg_resources', 'pip', 'certifi', 'easy_install.py', 'easy_install.pyc']
(Pdb) subprocess.check_output('ls -la "/home/test_user/pytesttmp/0b0a abdecf/lib/python2.7/site-packages/urllib3.egg-link"', shell=True)
b'-rw-r--r-- 1 test_user test_user 51 Feb 27 03:34 /home/test_user/pytesttmp/0b0a abdecf/lib/python2.7/site-packages/urllib3.egg-link\n'

@jaimergp
Copy link
Contributor Author

Awesome! Thanks @costrouc. Look how fun this is getting now:

  • The line that fails is 1688:
# should raise an error
with pytest.raises(PackagesNotFoundError):
    # TODO: This raises PackagesNotFoundError, but the error should really explain
    #       that we can't install urllib3 because it's already installed and
    #       unmanageable. The error should suggest trying to use pip to uninstall it.
    stdout, stderr, _ = run_command(Commands.INSTALL, prefix, "urllib3=1.20", "--dry-run")  # <<< THIS ONE

The TODO note says that we should actually see a different exception... which is the one we are getting 😂 :

________ IntegrationTests.test_conda_pip_interop_conda_editable_package ________
Traceback (most recent call last):
  File "/opt/conda-src/tests/test_create.py", line 1688, in test_conda_pip_interop_conda_editable_package
    stdout, stderr, _ = run_command(Commands.INSTALL, prefix, "urllib3=1.20", "--dry-run")
  File "/opt/conda-src/conda/testing/integration.py", line 287, in run_command
    result = do_call(args, p)
  File "/opt/conda-src/conda/cli/conda_argparse.py", line 92, in do_call
    return getattr(module, func_name)(args, parser)
  File "/opt/conda-src/conda/notices/core.py", line 121, in wrapper
    return func(*args, **kwargs)
  File "/opt/conda-src/conda/cli/main_install.py", line 20, in execute
    install(args, parser, 'install')
  File "/opt/conda-src/conda/cli/install.py", line 264, in install
    unlink_link_transaction = solver.solve_for_transaction(
  File "/opt/conda-src/conda/core/solve.py", line 130, in solve_for_transaction
    unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
  File "/opt/conda-src/conda/core/solve.py", line 182, in solve_for_diff
    raise RuntimeError("Cannot unlink unmanageable packages:%s"
RuntimeError: Cannot unlink unmanageable packages:
  - <develop>/pypi::urllib3-1.19.1-dev_0

However, at no point I see the conda_libmamba_solver involved in that traceback. Did you set up CONDA_SOLVER=libmamba before running the test?

Which branches are checked out in conda/conda and conda/conda-libmamba-solver, locally?

@costrouc
Copy link
Contributor

costrouc commented Feb 27, 2023

However, at no point I see the conda_libmamba_solver involved in that traceback. Did you set up CONDA_SOLVER=libmamba before running the test?

Yeah if I look at the context around the sovler being used in the test

self = <conda_libmamba_solver.solver.LibMambaSolver object at 0x7f484b7dbd60>
update_modifier = <UpdateModifier.FREEZE_INSTALLED: 'freeze_installed'>
deps_modifier = <DepsModifier.NOT_SET: 'not_set'>
prune = <conda.auxlib._Null object at 0x7f486ddd3eb0>
ignore_pinned = <conda.auxlib._Null object at 0x7f486ddd3eb0>
force_remove = <conda.auxlib._Null object at 0x7f486ddd3eb0>
force_reinstall = False
should_retry_solve = True

Which branches are checked out in conda/conda and conda/conda-libmamba-solver, locally?

conda conda/conda@598bc26e4 (main)

conda-libmamba-solver 02423c3 (conda-forge-ci)

@costrouc costrouc marked this pull request as ready for review February 27, 2023 18:57
Copy link
Contributor

@costrouc costrouc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaimergp looks like all test are passing and I can confirm that all packages from the base environment do come from conda-forge which was the goal of this PR. I've created an issue linked above which details the test that was disabled.

Copy link
Member

@jezdez jezdez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With conda/conda#12297 being merged, it might be useful to adopt the same pattern to build the test matrix via the exclude statement.

@jaimergp
Copy link
Contributor Author

We still need conda/conda#12389

@jaimergp jaimergp mentioned this pull request Feb 28, 2023
43 tasks
@jaimergp
Copy link
Contributor Author

Added #143 to track deselected upstream tests.

@jaimergp
Copy link
Contributor Author

jaimergp commented Mar 6, 2023

Well, we won't need to worry about that py37 error anymore because we are not supporting it anyway. See conda/conda#12436 for details.

@jaimergp
Copy link
Contributor Author

jaimergp commented Mar 6, 2023

@jaimergp
Copy link
Contributor Author

jaimergp commented Mar 6, 2023

Re-running failed jobs to see if the packaging issue was fixed.

@jaimergp
Copy link
Contributor Author

jaimergp commented Mar 7, 2023

@jezdez - can you take another look? This is ready for review / merge on my end, I think.

Copy link
Member

@jezdez jezdez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs slight tweaks to the test matrix still, right?

.github/workflows/upstream_tests.yml Show resolved Hide resolved
Comment on lines 358 to 381
- default-channel: 'conda-forge'
python-version: '3.9'
test-type: 'unit'
test-group: '1'
- default-channel: 'conda-forge'
python-version: '3.9'
test-type: 'unit'
test-group: '2'
- default-channel: 'conda-forge'
python-version: '3.9'
test-type: 'unit'
test-group: '3'
- default-channel: 'defaults'
python-version: '3.9'
test-type: 'integration'
test-group: '1'
- default-channel: 'defaults'
python-version: '3.9'
test-type: 'integration'
test-group: '2'
- default-channel: 'defaults'
python-version: '3.9'
test-type: 'integration'
test-group: '3'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should follow the same pattern as upstream, since this isn't testing the integration on conda-forge and not testing the unit tests on defaults.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh god it changed again in conda/conda#12413 🤦

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know :( I thought you knew about this already, I'm sorry!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad timing 😂 Sync'ed again, let's see how it goes.

@jezdez jezdez changed the title add conda-forge based CI Add conda-forge based CI Mar 7, 2023
@jezdez jezdez merged commit 511cc6a into main Mar 7, 2023
@jezdez jezdez deleted the conda-forge-ci branch March 7, 2023 12:35
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Mar 7, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants