# Pkg.add("Pkg") issue unknown package Pkg

**URL:** <https://discourse.julialang.org/t/pkg-add-pkg-issue-unknown-package-pkg/12481>\
**Category:** New to Julia\
**Tags:** pkg\
**Created:** [July 19, 2018, 4:30am UTC](https://discourse.julialang.org/t/pkg-add-pkg-issue-unknown-package-pkg/12481 "2018-07-19T04:30:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishwesh5](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@vishwesh5](https://discourse.julialang.org/u/vishwesh5)\
**Post date:** [July 19, 2018, 4:30am UTC](https://discourse.julialang.org/t/pkg-add-pkg-issue-unknown-package-pkg/12481/1 "2018-07-19T04:30:22Z")

</div>

Hi!  
I am trying to use Image Processing (with OpenCV) in Julia. The installation instructions say:

```julia
using Pkg
Pkg.add("Images")
Pkg.add("ImageMetadata")
Pkg.add("ImageView")
Pkg.add("TestImages")
Pkg.update()

```

I am using **v0.6.4** Julia version on Ubuntu 16.04. I tried using compiled binaries and even compiled Julia myself using github instructions.

When I try to run, `using Pkg`, I get the following error:

```julia
julia> using Pkg
ERROR: ArgumentError: Module Pkg not found in current path.
Run `Pkg.add("Pkg")` to install the Pkg package.
Stacktrace:
 [1] _require(::Symbol) at ./loading.jl:435
 [2] require(::Symbol) at ./loading.jl:405

```

When I do, `Pkg.add("Pkg")`, I get the following error:

```julia
julia> Pkg.add("Pkg")
ERROR: unknown package Pkg
macro expansion at ./pkg/entry.jl:53 [inlined]
(::Base.Pkg.Entry.##1#3{String,Base.Pkg.Types.VersionSet})() at ./task.jl:335
Stacktrace:
 [1] sync_end() at ./task.jl:287
 [2] macro expansion at ./task.jl:303 [inlined]
 [3] add(::String, ::Base.Pkg.Types.VersionSet) at ./pkg/entry.jl:51
 [4] (::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}})() at ./pkg/dir.jl:36
 [5] cd(::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}}, ::String) at ./file.jl:70
 [6] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N} where N) at ./pkg/dir.jl:36
 [7] add(::String) at ./pkg/pkg.jl:117

```

I tried using **Jula v0.7** (beta version), and `using Pkg` worked fine without any error. I was also able to add other packages mentioned before. But, when I do `using Images, ImageMetadata, TestImages, ImageView`, I again get an error in compilation.

Can someone help me out please? I even tried the same on Ubuntu 18.04 but the same errors.

Thanks  
Vishwesh

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [July 19, 2018, 5:15am UTC](https://discourse.julialang.org/t/pkg-add-pkg-issue-unknown-package-pkg/12481/2 "2018-07-19T05:15:39Z")

</div>

> [@vishwesh5](#):
>
> ```julia
> using Pkg 
> Pkg.add("Images")
> 
> ```

You have encountered an unstable documentation version. The above will apply to Julia v0.7 and compatible packages. The image processing stack for v0.7 is not quite ready for general use (we are actively working on it). Could you say where you saw this? Maybe there is a “stable” version of the corresponding document which applies to v0.6. Otherwise, you can try simply omitting the `using Pkg` step and doing `Pkg.update()` before the other `Pkg` calls, but there may be other inappropriate things in the unstable documents.

I think the documents at [https://juliaimages.github.io](https://juliaimages.github.io) are still set up for v0.6.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 19, 2018, 6:50am UTC](https://discourse.julialang.org/t/pkg-add-pkg-issue-unknown-package-pkg/12481/3 "2018-07-19T06:50:48Z")

</div>

In Julia 0.6 the package manager is not a standalone package, only a submodule of `Base`. You need `using Base.Pkg` on Julia 0.6. (However that is not needef since `Pkg` is exported and you can do `Pkg` operations without this `using` step.)

---

<div class="post-metadata">

**Author:** ![vishwesh5](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@vishwesh5](https://discourse.julialang.org/u/vishwesh5)\
**Post date:** [July 19, 2018, 12:31pm UTC](https://discourse.julialang.org/t/pkg-add-pkg-issue-unknown-package-pkg/12481/4 "2018-07-19T12:31:50Z")

</div>

Thank you @Ralph_Smith for the reply. This code was present in **Hands-On Computer Vision with Julia.**  
As you mentioned, I tried 0.7.0-beta version… I was able to carry out the `Pkg.add` steps. But, when I try `using` step, I get the following errors:

```julia
julia> using Images, ImageMetadata, TestImages, ImageView
[ Info: Precompiling module Images
WARNING: importing deprecated binding Base.fft into Images.
WARNING: importing deprecated binding Base.ifft into Images.
WARNING: could not import Base.linearindexing into Images
WARNING: Method definition (::Type{AxisArrays.CategoricalVector{T, A} where A<:AbstractArray{T, 1} where T})(AbstractArray{T, 1}) where {T} in module AxisArrays at /home/hp/.julia/packages/AxisArrays/uZ7J/src/categoricalvector.jl:43 overwritten at /home/hp/.julia/packages/AxisArrays/uZ7J/src/categoricalvector.jl:47.
WARNING: Method definition (::Type{AxisArrays.CategoricalVector{T, A} where A<:AbstractArray{T, 1} where T})(A<:AbstractArray{T, 1}) where {T, A<:AbstractArray{T, 1}} in module AxisArrays at /home/hp/.julia/packages/AxisArrays/uZ7J/src/categoricalvector.jl:47 overwritten at /home/hp/.julia/packages/AxisArrays/uZ7J/src/categoricalvector.jl:43.
WARNING: Method definition (::Type{AxisArrays.CategoricalVector{T, A} where A<:AbstractArray{T, 1} where T})(AbstractArray{T, 1}) where {T} in module AxisArrays at /home/hp/.julia/packages/AxisArrays/uZ7J/src/categoricalvector.jl:43 overwritten at /home/hp/.julia/packages/AxisArrays/uZ7J/src/categoricalvector.jl:47.
WARNING: importing deprecated binding Base.CartesianRange into ImageFiltering.
WARNING: Base.CartesianRange is deprecated, use CartesianIndices instead.
  likely near /home/hp/.julia/packages/ImageFiltering/cNt7/src/utils.jl:31
WARNING: Base.CartesianRange is deprecated, use CartesianIndices instead.
  likely near /home/hp/.julia/packages/ImageFiltering/cNt7/src/utils.jl:51
ERROR: LoadError: LoadError: TypeError: in apply_type, in Vararg count, expected Int64, got Type{CartesianIndex{0}}
Stacktrace:
 [1] top-level scope at none:0
 [2] include at ./boot.jl:317 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1034
 [4] include at ./sysimg.jl:29 [inlined]
 [5] include(::String) at /home/hp/.julia/packages/ImageFiltering/cNt7/src/ImageFiltering.jl:3
 [6] top-level scope at none:0
 [7] include at ./boot.jl:317 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1034
 [9] include(::Module, ::String) at ./sysimg.jl:29
 [10] top-level scope at none:0
 [11] eval at ./boot.jl:319 [inlined]
 [12] eval(::Expr) at ./client.jl:394
 [13] top-level scope at ./none:3 [inlined]
 [14] top-level scope at ./<missing>:0
in expression starting at /home/hp/.julia/packages/ImageFiltering/cNt7/src/utils.jl:51
in expression starting at /home/hp/.julia/packages/ImageFiltering/cNt7/src/ImageFiltering.jl:44
ERROR: LoadError: Failed to precompile ImageFiltering to /home/hp/.julia/compiled/v0.7/ImageFiltering/MN5u.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:298 [inlined]
 [3] compilecache(::Base.PkgId) at ./loading.jl:1173
 [4] _require(::Base.PkgId) at ./logging.jl:298
 [5] require(::Base.PkgId) at ./loading.jl:838
 [6] require(::Module, ::Symbol) at ./loading.jl:833
 [7] include at ./boot.jl:317 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1034
 [9] include(::Module, ::String) at ./sysimg.jl:29
 [10] top-level scope at none:0
 [11] eval at ./boot.jl:319 [inlined]
 [12] eval(::Expr) at ./client.jl:394
 [13] top-level scope at ./none:3 [inlined]
 [14] top-level scope at ./<missing>:0
in expression starting at /home/hp/.julia/packages/Images/HB5L/src/Images.jl:49
ERROR: Failed to precompile Images to /home/hp/.julia/compiled/v0.7/Images/H8Vx.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:298 [inlined]
 [3] compilecache(::Base.PkgId) at ./loading.jl:1173
 [4] _require(::Base.PkgId) at ./loading.jl:942
 [5] require(::Base.PkgId) at ./loading.jl:838
 [6] require(::Module, ::Symbol) at ./loading.jl:833

```

The book mentions this:

```julia
julia> VERSION
v"0.7.0-DEV.4465"

```

And the issue is, I can’t find this exact version anywhere. Adding to that, the book was first published in **June 2018** and updated in July 2018.

Can you please help me out with this?

Thanks

---

<div class="post-metadata">

**Author:** ![vishwesh5](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@vishwesh5](https://discourse.julialang.org/u/vishwesh5)\
**Post date:** [July 19, 2018, 12:31pm UTC](https://discourse.julialang.org/t/pkg-add-pkg-issue-unknown-package-pkg/12481/5 "2018-07-19T12:31:59Z")

</div>

Thanks @fredrikekre for the reply. I was able to work it out without using the `using Pkg` step. Hopefully things will work smoothly from now on for me.
