Macaulay2 / Macaulay2/M2

loadPackage fails for hard to determine reason

Open
#3,308 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Core
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

Sometimes, calling `loadPackage` can fail, saying it cannot be reloaded.

This error occurred in a set of packages I wrote a few years ago. I have boiled it down to its essence:

In `A.m2`, place the code
```
newPackage("A", Headline => "A")

```

In `B.m2`, place the code
```
needsPackage "A"
newPackage("B", Headline => "B")
```

Now after creating these files, try the following code.
```
elapsedTime installPackage "A"
elapsedTime installPackage "B"
restart
loadPackage "A"
```

This last line fails, since the package ''A" has been loaded when "B" is being scanned for its newPackage code (I think), and so has already been loaded. This is very hard to determine, as any installed package could do this and cause the package to simply be loaded already... Using `needsPackage` works fine.

Also, the time to install the package "A" seems to take 4-5 seconds on my machine, which seems quite large. (Same with "B").

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the A.m2 and B.m2 examples, then run the listed installPackage, restart, loadPackage, and needsPackage commands. Trace the package-loading path used by these commands and determine why A is considered already loaded; also measure whether the reported 4–5 second installation time is part of the same issue. Done means the reload behavior and installation-time concern have a clear resolution or documented scope.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.