# How to add package from a folder (not registered) into the the project?

**URL:** https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386
**Category:** General Usage
**Tags:** question
**Created:** [November 12, 2021, 3:09pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386 "2021-11-12T15:09:19Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)
#### Post date: [November 12, 2021, 3:09pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/1 "2021-11-12T15:09:19Z")

</div>

I am trying to add a package called `MyModule` (I have designed it) but I am not being able to

```julia
(@v1.6) pkg> add MyModule
ERROR: The following package names could not be resolved:
 * MyModule (not found in project, manifest or registry)

```

I tried this, but also an error

```julia
using Pkg
Pkg.add(path="path\\to\\file\\MyModule")

ERROR: LoadError: Path `path\to\file\MyModule` does not exist.
Stacktrace:

```

---

<div class="post-metadata">

### Author: ![mmiller](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mmiller/32/20805_2.png) [@mmiller](https://discourse.julialang.org/u/mmiller)
#### Post date: [November 12, 2021, 6:12pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/2 "2021-11-12T18:12:45Z")

</div>

To use what you have locally, use `develop` rather than `add`:

```nohighlight
help?> Pkg.develop
  Pkg.develop(pkg::Union{String, Vector{String}}; io::IO=stderr)
  Pkg.develop(pkgs::Union{Packagespec, Vector{Packagespec}}; io::IO=stderr)

  Make a package available for development by tracking it by path. If pkg is
  given with only a name or by a URL, the package will be downloaded to the
  location specified by the environment variable JULIA_PKG_DEVDIR, with
  .julia/dev as the default.

  If pkg is given as a local path, the package at that path will be tracked.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  # By name
  Pkg.develop("Example")
  
  # By url
  Pkg.develop(url="https://github.com/JuliaLang/Compat.jl")
  
  # By path
  Pkg.develop(path="MyJuliaPackages/Package.jl")

  See also PackageSpec

```

```nohighlight
using Pkg
Pkg.develop(path="path\\to\\file\\MyModule")

```

However the error is saying that the path to the module does not exist

You can check the directory exists with `isdir`:

```nohighlight
isdir("path\\to\\file\\MyModule")

```

If that returns `false`, then there is most likely a typo in the path!

---

<div class="post-metadata">

### Author: ![maxfreu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxfreu/32/17468_2.png) [@maxfreu](https://discourse.julialang.org/u/maxfreu)
#### Post date: [November 12, 2021, 6:30pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/3 "2021-11-12T18:30:54Z")

</div>

push!(LOAD\_PATH, path\_to\_parent\_dir\_of\_module)  
using MyModule

---

<div class="post-metadata">

### Author: ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)
#### Post date: [November 12, 2021, 7:13pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/5 "2021-11-12T19:13:12Z")

</div>

The `isdir` path is different than the one you gave to `Pkg.develop`

---

<div class="post-metadata">

### Author: ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)
#### Post date: [November 12, 2021, 7:15pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/6 "2021-11-12T19:15:32Z")

</div>

@pdeffebach  
Excuse me, I just copied it plus my module name of `ModuleClasses` so the path will be `"C:\\Users\\amroa\\OneDrive\\Desktop\\Test\\Classes\\ModuleClasses"`,  
@mmiller do you agree?

---

<div class="post-metadata">

### Author: ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)
#### Post date: [November 12, 2021, 7:30pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/7 "2021-11-12T19:30:11Z")

</div>

Check with `isdir`

---

<div class="post-metadata">

### Author: ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)
#### Post date: [November 12, 2021, 7:33pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/8 "2021-11-12T19:33:15Z")

</div>

@pdeffebach  
Can you please paste the correct path that I need to put it in `Pkg.develop(path="")` based on the below to make it clear for me"

```julia
julia> isdir("C:\\Users\\amroa\\OneDrive\\Desktop\\Test\\Classes")
true
julia> Pkg.develop(path="C:\\Users\\amroa\\OneDrive\\Desktop\\Test\\Classes\\ModuleClasses")

```

---

<div class="post-metadata">

### Author: ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)
#### Post date: [November 12, 2021, 7:34pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/9 "2021-11-12T19:34:26Z")

</div>

`develop` will not make the directory for you.

Please check the output of

```julia
isdir("C:\\Users\\amroa\\OneDrive\\Desktop\\Test\\Classes\\ModuleClasses")

```

---

<div class="post-metadata">

### Author: ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)
#### Post date: [November 12, 2021, 7:58pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/11 "2021-11-12T19:58:18Z")

</div>

In Julia, a package is a folder, with a specific folder structure, not a file. Please read [these docs](https://docs.julialang.org/en/v1/stdlib/Pkg/) to better understand. Your file `ModuleClasses.jl` needs to be in the `src` sub-folder of a folder titled `ModuleClasses`.

---

<div class="post-metadata">

### Author: ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)
#### Post date: [November 12, 2021, 8:22pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/13 "2021-11-12T20:22:45Z")

</div>

Looks like you didn’t do everything yet.

Take a look at `Pkg.generate` or [PkgTemplates.jl](https://github.com/invenia/PkgTemplates.jl) for more detailed advice on making packages with the right structure.

---

<div class="post-metadata">

### Author: ![mmiller](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mmiller/32/20805_2.png) [@mmiller](https://discourse.julialang.org/u/mmiller)
#### Post date: [November 14, 2021, 1:01pm UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-folder-not-registered-into-the-the-project/71386/14 "2021-11-14T13:01:19Z")

</div>

This error:

```julia
ERROR: Did not find a git repository at `C:\Users\amroa\OneDrive - polymtl.ca\AmroAlsabbagh\Code\Julia\Tests and Notes\16- Create Package\ModuleClasses

```

Is because `Pkg.add` looks for a git repository. If you do `Pkg.develop` instead, it will not do this and use the path supplied to the keyword argument.

Please try the below and see if it works!

```nohighlight
Pkg.develop(path="C:\\Users\\amroa\\OneDrive - polymtl.ca\\AmroAlsabbagh\\Code\\Julia\\Tests and Notes\\16- Create Package\\ModuleClasses")

```
