# Problem using modules

**URL:** <https://discourse.julialang.org/t/problem-using-modules/50960>\
**Category:** New to Julia\
**Created:** [November 29, 2020, 8:30pm UTC](https://discourse.julialang.org/t/problem-using-modules/50960 "2020-11-29T20:30:52Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [November 29, 2020, 8:30pm UTC](https://discourse.julialang.org/t/problem-using-modules/50960/1 "2020-11-29T20:30:52Z")

</div>

Hello I used PkgTemplates.jl to create package all works I have directory structure as below

![image](https://global.discourse-cdn.com/julialang/original/3X/9/8/98b3de1fb7530298c76861fe27534a84fe2676f2.png)  
but when I try to test a package from src (using generated by a template test file) I get

LoadError: ArgumentError: Package PetJuliaVascProsthesis not found in current path:

- Run `import Pkg; Pkg.add("PetJuliaVascProsthesis")` to install the PetJuliaVascProsthesis package.

PetJuliaVascProsthesis code what I do incorrectly?

```julia
module PetJuliaVascProsthesis
greet() = print("helloooo 22")
my_f(x,y) = 4000x+y
#include("basicDicomLoad.jl")
# Write your package code here.
end

```

and test

```julia
using PetJuliaVascProsthesis
using Test
using basicDicomLoad

println(basicDicomLoad.loadInterpolatedPet("/home/jagiellonczyk/Downloads/sample1-20201128T120220Z-001/sample1/DICOM"))

@testset "PetJuliaVascProsthesis.jl" begin

    
end

```

Thanks!

---

<div class="post-metadata">

**Author:** ![AndiMD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andimd/32/6531_2.png) [@AndiMD](https://discourse.julialang.org/u/AndiMD)\
**Post date:** [November 30, 2020, 12:34am UTC](https://discourse.julialang.org/t/problem-using-modules/50960/2 "2020-11-30T00:34:53Z")

</div>

Have you activated the package environment?  
`]activate path/to/PetJuliaVascProsthesis`  
After this, `using PetJuliaVascProsthesis` should work.  
Alternatively, start julia with the argument  
`julia --project=path/to/PetJuliaVascProsthesis`

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [November 30, 2020, 5:16am UTC](https://discourse.julialang.org/t/problem-using-modules/50960/3 "2020-11-30T05:16:25Z")

</div>

> [@AndiMD](#):
>
> activate path/to/PetJuliaVascProsthesis

Thank You for a reply ! I activated package as can be seen in repl ! but I still do sth incorrectly  
\*\*

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/6/c628ffadca2172c14296502b35bd4aa26cce6a60.png) \*\*

---

<div class="post-metadata">

**Author:** ![sairus7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sairus7/32/10816_2.png) [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Post date:** [November 30, 2020, 11:10am UTC](https://discourse.julialang.org/t/problem-using-modules/50960/4 "2020-11-30T11:10:22Z")

</div>

Looks like you try to run it line-by-line, maybe you missed running lines with `using`?

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [November 30, 2020, 12:43pm UTC](https://discourse.julialang.org/t/problem-using-modules/50960/5 "2020-11-30T12:43:26Z")

</div>

@Jakub_Mitura Please tell us about the interesting work you are doing. I do know that PET will very probably be Positron Emission Tomography!

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [November 30, 2020, 6:46pm UTC](https://discourse.julialang.org/t/problem-using-modules/50960/6 "2020-11-30T18:46:13Z")

</div>

No I used run all method and still get  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/9/9/999af76e0ad905d8ba627840025cd42329df5d9f.png)

In order to get full reference  
My github repo  
[https://github.com/jakubMitura14/petJuliaVascProsthesis.jl](https://github.com/jakubMitura14/petJuliaVascProsthesis.jl)

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [November 30, 2020, 7:01pm UTC](https://discourse.julialang.org/t/problem-using-modules/50960/7 "2020-11-30T19:01:04Z")

</div>

@johnh happy to hear intrest Generally I am physician during specialization in nuclear medicine I am doing my Phd on usage of FDG PET/CT in infections of vascular prosthesis I had created only some tiny project in pytorch yet (I mean from macine learning I am programming for couple years in java, kotlin, javascript, python and now starting julia), This project I will take first all my controll group and study group to try to learn a network some segmentation of vascular prosthesis (probably I will concentrate on aorto bi femoral as those are most common) I have about 30 in study and 20 in control group plus i will add some augmantation on the rotating on Y axis and some moderate gaussian elastic deformations, maybe I will think of sth else but most other augmentation techniques that I had read will not work here , when segmentation will be done I will cut sth like 2 cm around prosthesis and try to analyze this area for patterns - probably dividing this ring like areas to parts and analyze them via 3d convolutions (I know that ussually 3d analysis is not done becouse of computation problems but I hope that strategy i envisioned would make amount of voxels small enough) Of course there will be skip connections and as additional way to improve chance of convergence I am planning to add simplified boolean 3d tensor (from area around the prosthesis) that will just tell wether a voxel is below or above a treshold (the most important information while looking for prosthesis infection is presence of gas bubbles that have far lower density than anything else)  
Why this may be relevant? lack of operation when there is infection of aortic vascular prosthesis according to some authors is 100% and risk of patient death when operation is done may be as high as 50% wrong decision here makes huge diffrence, and there are not many cases of it so there are not many physicians having any experience with it.

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [December 1, 2020, 7:17am UTC](https://discourse.julialang.org/t/problem-using-modules/50960/8 "2020-12-01T07:17:45Z")

</div>

@Jakub_Mitura Wow! That is fantastic work.  
Many years ago when I worked in a PET scanning unit one of the doctors was conducting a study on patients who had I think heart surgery or artery surgery. He was scanning the blood supply to their brains post surgery. One of the rather sad side effects of major surgery like that is plaques can break off and occlude the vessels which supply the brain, which is not fatal but can have effects.

---

<div class="post-metadata">

**Author:** ![AndiMD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andimd/32/6531_2.png) [@AndiMD](https://discourse.julialang.org/u/AndiMD)\
**Post date:** [December 1, 2020, 3:16pm UTC](https://discourse.julialang.org/t/problem-using-modules/50960/9 "2020-12-01T15:16:58Z")

</div>

I cloned your repo, works for me.  
~~Make sure the environment is activated by pressing `]`. You should see `(PetJuliaVascProsthesis) pkg>`.  
After that, if `using PetJuliaVascProsthesis` still does not work, I suspect Atom is doing something funny.~~  
EDIT: This is probably wrong, see comment of @MA_Laforge

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [December 1, 2020, 7:07pm UTC](https://discourse.julialang.org/t/problem-using-modules/50960/10 "2020-12-01T19:07:32Z")

</div>

So I suppose Atom id doing sth funny 🙂

---

<div class="post-metadata">

**Author:** ![MA\_Laforge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ma_laforge/32/385_2.png) [@MA\_Laforge](https://discourse.julialang.org/u/MA_Laforge)\
**Post date:** [December 1, 2020, 9:03pm UTC](https://discourse.julialang.org/t/problem-using-modules/50960/11 "2020-12-01T21:03:58Z")

</div>

@AndiMD :

> Have you activated the package environment?  
> `]activate path/to/PetJuliaVascProsthesis`

In my experience, activating your directory this way does not help if your intent is to use `PetJuliaVascProsthesis` as a module (i.e. it does not make your module available to be loaded with `using` or `import`).

### So what does `activate` do?

What `activate`-ing does is bring all packages you `add`ed to `PetJuliaVascProsthesis/Project.toml` available for your current Julia working environment.

Unless I am mistaken: I don’t think that’s what you are trying to do here, @Jakub_Mitura

### What to do to get `Pkg.add` to work:

Unless I am mistaken, your error with `Pkg.add` was in your argument. You probably wanted the following:

```julia-auto
Pkg.add(url="/path/to/PetJuliaVascProsthesis")

```

(Though you might want to check the help system using `?Pkg.add`)  
You might also need to provide absolute path values, I am unsure about this part.

### But here is what _really_ think you want:

If you are developing the package, you probably want to use `develop` instead of `add`:

```julia-auto
Pkg.develop(path="/path/to/PetJuliaVascProsthesis")

```

This way, you can test the changes you are currently making to that Git repository.

When you use `add` instead of `develop`:

- Julia actually clones your directory to its own managed ``~/.julia/…` subdirectory.
- It then uses _ **that** _ clone to run your code.

In other words, to try out changes you are making to your packages (when using `add` instead of `develop`):

1. You must commit the changes to your package in “/path/to/PetJuliaVascProsthesis”.
2. You must then update your package using Julia’s package manager (it will then update its Git directory accordingly.)

So I would just use `Pkg.develop()`. It simplifies the process of making code changes to your module.

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [December 3, 2020, 6:07am UTC](https://discourse.julialang.org/t/problem-using-modules/50960/12 "2020-12-03T06:07:17Z")

</div>

> [@MA\_Laforge](#):
>
> ```julia
> Pkg.develop(path="/path/to/PetJuliaVascProsthesis")
> 
> ```

Thanks It helped !
