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

Remove julia code and dependencies #541

Merged
merged 9 commits into from
Jan 22, 2025
Merged

Remove julia code and dependencies #541

merged 9 commits into from
Jan 22, 2025

Conversation

apchytr
Copy link
Collaborator

@apchytr apchytr commented Jan 20, 2025

Opening on behalf of @aplund

Context: Julia code was introduced previously to try and work around algorithmic instabilities in the computation of Fock coefficients from Gaussian Bargmann functions. This introduced a hard dependency on julia, which made installation tricker. In the end, it was found that the more stable approach was achieved by changing the algorithm to average over the possible lattice sites.

Description of the Change: This change removes the julia code and the dependencies of that code. The PRECISION_BITS_HERMITE_POLY setting is removed, as that was the switch to turn on the julia implementation. The julia code has been pushed into the branch
https://github.com/XanaduAI/GaussianBargmannFock which stores implementations of this function.

Benefits: There is no hard dependency on juliacall and the julia language. This should ease installation, particularly on Windows platforms.

Possible Drawbacks: The ability switch to using the julia implementation is gone without a setting to bring it back quickly.

**Context:** Julia code was introduced previously to try and work around
algorithmic instabilities in the computation of Fock coefficients from
Gaussian Bargmann functions.  This introduced a hard dependency on
`julia`, which made installation tricker.  In the end, it was found that
the more stable approach was achieved by changing the algorithm to
average over the possible lattice sites.

**Description of the Change:** This change removes the `julia` code and
the dependencies of that code.  The PRECISION_BITS_HERMITE_POLY setting
is removed, as that was the switch to turn on the `julia` implementation.
The `julia` code has been pushed into the branch
<https://github.com/XanaduAI/GaussianBargmannFock> which stores
implementations of this function.

**Benefits:** There is no hard dependency on `juliacall` and the `julia`
language.  This should ease installation, particularly on Windows
platforms.

**Possible Drawbacks:** The ability switch to using the `julia`
implementation is gone without a setting to bring it back quickly.

Signed-off-by: Anthony <[email protected]>
@timmysilv
Copy link
Collaborator

happy to see the hard dependency go away, though I have some questions:

  • have we tried installing on Windows and confirmed that juliacall doesn't work nicely there?
  • can you undo the changes to poetry.lock and re-run poetry lock with the --no-update option to keep things stable?

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.05%. Comparing base (14ca459) to head (0024b9d).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #541      +/-   ##
===========================================
- Coverage    90.08%   90.05%   -0.04%     
===========================================
  Files          102      102              
  Lines         6243     6222      -21     
===========================================
- Hits          5624     5603      -21     
  Misses         619      619              
Files with missing lines Coverage Δ
mrmustard/math/backend_numpy.py 100.00% <ø> (ø)
mrmustard/math/backend_tensorflow.py 100.00% <ø> (ø)
mrmustard/utils/settings.py 100.00% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14ca459...0024b9d. Read the comment docs.

@aplund
Copy link
Collaborator

aplund commented Jan 20, 2025

I get this error with --no-update:

$ poetry lock --no-update -v
Using virtualenv: /home/lund/.pyenv/versions/3.11.9/envs/mrmustard
Resolving dependencies... (0.9s)

  OverrideNeeded

  ({Package('pylint', '3.3.1'): {'dill': <Dependency dill (>=0.2)>}}, {Package('pylint', '3.3.1'): {'dill': <Dependency dill (>=0.3.7)>}}, {Package('pylint', '3.3.1'): {'dill': <Dependency dill (>=0.3.6)>}})

  at ~/.pyenv/versions/3.11.9/envs/mrmustard/lib/python3.11/site-packages/poetry/puzzle/provider.py:653 in complete_package
      649│                     current_overrides.update({package: package_overrides})
      650│                     overrides.append(current_overrides)
      651│
      652│             if overrides:
    → 653│                 raise OverrideNeeded(*overrides)
      654│
      655│         # Modifying dependencies as needed
      656│         clean_dependencies = []
      657│         for dep in dependencies:

The following error occurred when trying to handle this error:


  OverrideNeeded

  ({Package('pylint', '3.3.1'): {'dill': <Dependency dill (>=0.2)>}, Package('ray', '2.39.0', features=frozenset({'tune'})): {'pyarrow': <Dependency pyarrow (>=6.0.1,<18)>}}, {Package('pylint', '3.3.1'): {'dill': <Dependency dill (>=0.2)>}, Package('ray', '2.39.0', features=frozenset({'tune'})): {'pyarrow': <Dependency pyarrow (>=6.0.1)>}})

  at ~/.pyenv/versions/3.11.9/envs/mrmustard/lib/python3.11/site-packages/poetry/puzzle/provider.py:653 in complete_package
      649│                     current_overrides.update({package: package_overrides})
      650│                     overrides.append(current_overrides)
      651│
      652│             if overrides:
    → 653│                 raise OverrideNeeded(*overrides)
      654│
      655│         # Modifying dependencies as needed
      656│         clean_dependencies = []
      657│         for dep in dependencies:

The following error occurred when trying to handle this error:


  OverrideNeeded

  ({Package('pylint', '3.3.1'): {'dill': <Dependency dill (>=0.2)>}, Package('ray', '2.39.0', features=frozenset({'tune'})): {'pyarrow': <Dependency pyarrow (>=6.0.1,<18)>}, Package('ml-dtypes', '0.4.1'): {'numpy': <Dependency numpy (>=1.21.2)>}}, {Package('pylint', '3.3.1'): {'dill': <Dependency dill (>=0.2)>}, Package('ray', '2.39.0', features=frozenset({'tune'})): {'pyarrow': <Dependency pyarrow (>=6.0.1,<18)>}, Package('ml-dtypes', '0.4.1'): {'numpy': <Dependency numpy (>1.20)>}})

  at ~/.pyenv/versions/3.11.9/envs/mrmustard/lib/python3.11/site-packages/poetry/puzzle/provider.py:653 in complete_package
      649│                     current_overrides.update({package: package_overrides})
      650│                     overrides.append(current_overrides)
      651│
      652│             if overrides:
    → 653│                 raise OverrideNeeded(*overrides)
      654│
      655│         # Modifying dependencies as needed
      656│         clean_dependencies = []
      657│         for dep in dependencies:

The following error occurred when trying to handle this error:


  IndexError

  list index out of range

  at ~/.pyenv/versions/3.11.9/envs/mrmustard/lib/python3.11/site-packages/poetry/repositories/http_repository.py:328 in _get_info_from_links
      324│                 return self._get_info_from_metadata(
      325│                     first_wheel
      326│                 ) or self._get_info_from_wheel(first_wheel)
      327│
    → 328│         return self._get_info_from_metadata(sdists[0]) or self._get_info_from_sdist(
      329│             sdists[0]
      330│         )
      331│
      332│     def _links_to_data(self, links: list[Link], data: PackageInfo) -> dict[str, Any]:

@apchytr
Copy link
Collaborator Author

apchytr commented Jan 20, 2025

@aplund what version of poetry do you have installed? Is the environment a fresh one?

@aplund
Copy link
Collaborator

aplund commented Jan 20, 2025

@aplund what version of poetry do you have installed? Is the environment a fresh one?

It's not a fresh env, but I can rebuild it and try again:

$ poetry --version
Poetry (version 1.8.4)

@apchytr
Copy link
Collaborator Author

apchytr commented Jan 20, 2025

@aplund what version of poetry do you have installed? Is the environment a fresh one?

It's not a fresh env, but I can rebuild it and try again:

$ poetry --version
Poetry (version 1.8.4)

Yeah can you try with poetry 1.8.5 and a fresh env? If that doesnt work Im not sure what's happening since I cant reproduce the error locally

@aplund
Copy link
Collaborator

aplund commented Jan 20, 2025

Looks like poetry is super-picky for minor version numbers. I used 1.8.5 and all good.

@aplund aplund requested review from ziofil and timmysilv January 21, 2025 00:10
@timmysilv
Copy link
Collaborator

re: trying it. I did, and I hit this issue: JuliaLang/julia#52205

I tried the simple solutions, and they didn't work. Ultimately, downloading Julia manually and following this comment worked, but this is unfortunately involved for Windows users.

@timmysilv timmysilv merged commit 2bd6489 into develop Jan 22, 2025
10 checks passed
@timmysilv timmysilv deleted the juliaRem branch January 22, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants