# Package dependency problem

**URL:** <https://racket.discourse.group/t/package-dependency-problem/2490>\
**Category:** Questions & Answers\
**Tags:** package, dependency\
**Created:** [November 10, 2023, 2:16pm UTC](https://racket.discourse.group/t/package-dependency-problem/2490 "2023-11-10T14:16:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![matteo-daddio](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/matteo-daddio/32/1245_2.png) [@matteo-daddio](https://racket.discourse.group/u/matteo-daddio)\
**Post date:** [November 10, 2023, 2:16pm UTC](https://racket.discourse.group/t/package-dependency-problem/2490/1 "2023-11-10T14:16:45Z")

</div>

Hi,

as an exercise I developed a data structure, a double linked ring.  
I create a github repository and I put it in the Racket catalog.  
I took _Ring Buffer_ and _Priority Queues_ as examples.  
Everything is fine except the package dependencies.

I installed the package through `raco pkg install double-linked-ring` and it  
installed the `data/double-linked-ring` collection.  
Then I tryed `raco setup --check-pkg-deps double-linked-ring` and  
`raco setup --check-pkg-deps data/double-linked-ring` but they didn't work.  
The error message was `collection-path: collection not found`.

Then tried `raco setup --check-pkg-deps data` and it worked, but  
I can't understand the dependency messages:

```scheme
raco setup: --- checking package dependencies ---
raco setup: found undeclared dependency:
raco setup: mode: run
raco setup: for package: "double-linked-ring"
raco setup: on package: "rackunit-lib"
raco setup: dependent source: C:\Users\scacco matto\AppData\Roaming\Racket\8.10\pkgs\double-linked-ring\data\compiled\test_rkt.zo
raco setup: used module: (lib "rackunit/main.rkt")
raco setup: found undeclared dependency:
raco setup: mode: run
raco setup: for package: "double-linked-ring"
raco setup: on package: "rackunit-lib"
raco setup: dependent source: C:\Users\scacco matto\AppData\Roaming\Racket\8.10\pkgs\double-linked-ring\data\compiled\test_rkt.zo
raco setup: used module: (lib "rackunit/text-ui.rkt")
raco setup: --- summary of package problems ---
raco setup: undeclared dependency detected
raco setup: for package: "double-linked-ring"
raco setup: on package:
raco setup: "rackunit-lib"

```

Can you help me?

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [November 10, 2023, 3:13pm UTC](https://racket.discourse.group/t/package-dependency-problem/2490/2 "2023-11-10T15:13:56Z")

</div>

1. Your package depends on `rackunit-lib` at runtime, not just at build time.
2. `raco setup` in the default mode takes a _collection_ as an argument. `data` is a collection, but `data/double-linked-ring` is not (it's a module path for a specific module) and `double-linked-ring` is also not (it's a package name). Probably you want `raco setup --pkgs double-linked-ring` or maybe `raco setup data`.
3. You can use `raco setup --fix-pkg-deps --pkgs double-linked-ring` to fix the problem automatically.

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [November 10, 2023, 3:21pm UTC](https://racket.discourse.group/t/package-dependency-problem/2490/3 "2023-11-10T15:21:50Z")

</div>

It appears you have a test file that depends on rackunit, so you need to add `rackunit-lib` to your info.rkt.

N.B. `raco setup` typically accepts a collection name (such as `data`); if you want to use a package name, you use `--pkgs`.

---

<div class="post-metadata">

**Author:** ![matteo-daddio](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/matteo-daddio/32/1245_2.png) [@matteo-daddio](https://racket.discourse.group/u/matteo-daddio)\
**Post date:** [November 10, 2023, 3:34pm UTC](https://racket.discourse.group/t/package-dependency-problem/2490/4 "2023-11-10T15:34:29Z")

</div>

Thank you, where can I find it in the documentation?

Matteo

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [November 10, 2023, 4:08pm UTC](https://racket.discourse.group/t/package-dependency-problem/2490/5 "2023-11-10T16:08:57Z")

</div>

1. Documentation about dependencies is here: [4&nbsp;Package Metadata](https://docs.racket-lang.org/pkg/metadata.html#%28idx._%28gentag._3._%28lib._pkg%2Fscribblings%2Fpkg..scrbl%29%29%29)
2. Documentation about `raco setup` command line use is here: [6.1&nbsp;Running raco setup](https://docs.racket-lang.org/raco/running.html)
3. Documentation about dependency checking is here: [6.5&nbsp;Package Dependency Checking](https://docs.racket-lang.org/raco/setup-check-deps.html)

---

<div class="post-metadata">

**Author:** ![matteo-daddio](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/matteo-daddio/32/1245_2.png) [@matteo-daddio](https://racket.discourse.group/u/matteo-daddio)\
**Post date:** [November 13, 2023, 6:32pm UTC](https://racket.discourse.group/t/package-dependency-problem/2490/6 "2023-11-13T18:32:22Z")

</div>

Thanks for your help.

I’m starting to understand the package system, especially the relationship between packages and collections. It’s very sofisticated and very interesting.

The easiest solution I found is to move the test.rkt module outside the data collection directory. This was the problem. Now the package works correctly.

I put the test module in the data directory on purpose, I wanted to see what would happen.

If you need a double linked ring you can use my package. The documentation is under the _Data Structure_ section.

If you have suggestions on how to improve it you are welcome.

Matteo
