# Cannot use any package after self-compiled Julia v1.7 distributed

**URL:** https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833
**Category:** General Usage
**Created:** [February 21, 2022, 9:42am UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833 "2022-02-21T09:42:22Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Jieyi\_Xiong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jieyi_xiong/32/32032_2.png) [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)
#### Post date: [February 21, 2022, 9:42am UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/1 "2022-02-21T09:42:23Z")

</div>

I use two Linux servers. Although the two servers are not exactly identical, I can still compile Julia v1.6.x in one server and copy the `usr/` to another server, and Julia works fine in both machines (I do it because Julia compiling is only succeeded on one server). However, when I compile Julia v1.7.2 in one machine and copied it to another, although I can still startup Julia without error, I cannot use or add any packages, even the internal packages:

```julia
julia> using Printf
ERROR: ArgumentError: Package Printf not found in current path:
- Run `import Pkg; Pkg.add("Printf")` to install the Printf package.

Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:967

julia> import Pkg
ERROR: ArgumentError: Package Pkg not found in current path:
- Run `import Pkg; Pkg.add("Pkg")` to install the Pkg package.

Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:967

(v1.7) pkg> add Pkg
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
ERROR: The following package names could not be resolved:
 * Pkg (44cfe95a-1eb2-52ea-b672-e2afdf69b78f in manifest but not in project)

julia> LOAD_PATH
3-element Vector{String}:
 "@"
 "@v#.#"
 "@stdlib"

julia> versioninfo()
Julia Version 1.7.2
Commit bf53498* (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E7-4880 v2 @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, ivybridge)

```

Here is my Make.user:

```julia
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
MARCH=x86-64
JULIA_TARGET_CPU=x86-64

```

Are there any tricks I can do to make Julia v1.7 distributable as the previous v1.6 version?

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [February 21, 2022, 9:49am UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/2 "2022-02-21T09:49:34Z")

</div>

> [@Jieyi\_Xiong](#):
>
> `CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0`

I don’t think this is related to your issue, but why this? It’s a bit uncommon to use the C++03 string ABI nowadays.

---

<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: [February 21, 2022, 9:58am UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/3 "2022-02-21T09:58:03Z")

</div>

Check the folder that `Base.load_path_expand("@stdlib")` shows. `readdir` on that path should show you something like:

```julia
julia> readdir(Base.load_path_expand("@stdlib"))
58-element Vector{String}:
 "ArgTools"
 "Artifacts"
 "Base64"
 ⋮
 "libblastrampoline_jll"
 "nghttp2_jll"
 "p7zip_jll"

```

If not, then probably something went wrong in your install and/or copying.

---

<div class="post-metadata">

### Author: ![Jieyi\_Xiong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jieyi_xiong/32/32032_2.png) [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)
#### Post date: [February 21, 2022, 10:02am UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/4 "2022-02-21T10:02:21Z")

</div>

Indeed I’m not clear what’s its meaning but just copied the whole Make.user from somewhere when I compiled Julia 1.6, and it works. I tried removing this sentence and didn’t find anything changes for the compiling. Maybe it should be removed as you were concerned.

---

<div class="post-metadata">

### Author: ![Jieyi\_Xiong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jieyi_xiong/32/32032_2.png) [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)
#### Post date: [February 21, 2022, 10:06am UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/5 "2022-02-21T10:06:06Z")

</div>

Thanks. I tried your suggestion. It seems rather normal, I think:

```julia
julia> readdir(Base.load_path_expand("@stdlib"))
58-element Vector{String}:
 "ArgTools"
 "Artifacts"
 "Base64"
 "CRC32c"
 "CompilerSupportLibraries_jll"
 "Dates"
 "DelimitedFiles"
 "Distributed"
 "Downloads"
 "FileWatching"
 "Future"
 "GMP_jll"
 "InteractiveUtils"
 "LLVMLibUnwind_jll"
 "LazyArtifacts"
 "LibCURL"
 "LibCURL_jll"
 "LibGit2"
 "LibGit2_jll"
 "LibSSH2_jll"
 "LibUV_jll"
 "LibUnwind_jll"
 "Libdl"
 "LinearAlgebra"
 "Logging"
 "MPFR_jll"
 "Markdown"
 "MbedTLS_jll"
 "Mmap"
 "MozillaCACerts_jll"
 "NetworkOptions"
 "OpenBLAS_jll"
 "OpenLibm_jll"
 "PCRE2_jll"
 "Pkg"
 "Printf"
 "Profile"
 "REPL"
 "Random"
 "SHA"
 "Serialization"
 "SharedArrays"
 "Sockets"
 "SparseArrays"
 "Statistics"
 "SuiteSparse"
 "SuiteSparse_jll"
 "TOML"
 "Tar"
 "Test"
 "UUIDs"
 "Unicode"
 "Zlib_jll"
 "dSFMT_jll"
 "libLLVM_jll"
 "libblastrampoline_jll"
 "nghttp2_jll"
 "p7zip_jll"

julia> using Pkg
ERROR: ArgumentError: Package Pkg not found in current path:
- Run `import Pkg; Pkg.add("Pkg")` to install the Pkg package.

Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:967

```

---

<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: [February 21, 2022, 10:10am UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/6 "2022-02-21T10:10:56Z")

</div>

And you verified that that path is contained in the load path? I.e.

```julia
Base.load_path_expand("@stdlib") in Base.load_path()

```

returns `true`?

---

<div class="post-metadata">

### Author: ![Jieyi\_Xiong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jieyi_xiong/32/32032_2.png) [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)
#### Post date: [February 21, 2022, 10:18am UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/7 "2022-02-21T10:18:55Z")

</div>

Indeed, the load path is contained:

```julia
julia> Base.load_path_expand("@stdlib") in Base.load_path()
true

```

---

<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: [February 21, 2022, 11:11am UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/8 "2022-02-21T11:11:25Z")

</div>

Does e.g. the `Pkg` entrypoints exist?

```julia
julia> isfile(joinpath(Base.load_path_expand("@stdlib"), "Pkg", "Project.toml"))
true

julia> isfile(joinpath(Base.load_path_expand("@stdlib"), "Pkg", "src", "Pkg.jl"))
true

```

---

<div class="post-metadata">

### Author: ![Jieyi\_Xiong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jieyi_xiong/32/32032_2.png) [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)
#### Post date: [February 21, 2022, 12:57pm UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/9 "2022-02-21T12:57:17Z")

</div>

Thanks to your suggestion, I found the problem. The folders under usr/share/julia/stdlib/v1.7 are all softlinks. They became invalid after being moved to another server. After I replace them with the real folders from stdlib/, the problem is solved. Now the Julia packages work fine on both servers. Many thanks for your help!

---

<div class="post-metadata">

### Author: ![Jieyi\_Xiong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jieyi_xiong/32/32032_2.png) [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)
#### Post date: [February 21, 2022, 1:09pm UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/10 "2022-02-21T13:09:14Z")

</div>

It is because the folders under usr/share/julia/stdlib/v1.7 are all symbolic links. They became invalid after being moved to another server. (Thanks @fredrikekre 's suggestion, checking with `isfile(joinpath(Base.load_path_expand("@stdlib"), "Pkg", "Project.toml"))` return `false`.) After I replaced them with the real folders from stdlib/, the problem is solved. Maybe I should distribute self-compiled julia using `rsync -L` to avoid invalid symbolic links.

---

<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: [February 21, 2022, 1:13pm UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/11 "2022-02-21T13:13:40Z")

</div>

If you run `make binary-dist` you will get a tarball that contains everything and you can copy and unpack that one instead.

---

<div class="post-metadata">

### Author: ![Jieyi\_Xiong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jieyi_xiong/32/32032_2.png) [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)
#### Post date: [February 21, 2022, 1:44pm UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/13 "2022-02-21T13:44:13Z")

</div>

Indeed `binary-dist` does not work for me. It ended with the below error. That’s why I directly moved the `usr/` folder for distribution. FYI:

```julia
# Copy in all .jl sources as well
mkdir -p /data/projects/programs/julia1.0/julia/julia-5efa17c3db/share/julia/base /data/projects/programs/julia1.0/julia/julia-5efa17c3db/share/julia/test
cp -R -L /data/projects/programs/julia1.0/julia/base/* /data/projects/programs/julia1.0/julia/julia-5efa17c3db/share/julia/base
cp -R -L /data/projects/programs/julia1.0/julia/test/* /data/projects/programs/julia1.0/julia/julia-5efa17c3db/share/julia/test
cp -R -L /data/projects/programs/julia1.0/julia/usr/share/julia/* /data/projects/programs/julia1.0/julia/julia-5efa17c3db/share/julia
cp: cannot copy cyclic symbolic link '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.0/Pkg-aaf4e6e8ab784f7435c1bdc56832bc03e014dedb/Pkg-aaf4e6e8ab784f7435c1bdc56832bc03e014dedb'          
cp: cannot copy cyclic symbolic link '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.0/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1'
cp: cannot stat '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.3/Statistics': No such file or directory
cp: cannot stat '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.3/SuiteSparse': No such file or directory
cp: cannot stat '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.1/Statistics': No such file or directory
cp: cannot stat '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.1/SuiteSparse': No such file or directory
cp: cannot copy cyclic symbolic link '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.5/Pkg/Pkg-aaf4e6e8ab784f7435c1bdc56832bc03e014dedb'
cp: cannot copy cyclic symbolic link '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.5/Statistics/Statistics-cde87c8062032883165cd242f4a5c6b7943cb0b1'
cp: cannot stat '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.5/SuiteSparse': No such file or directory
cp: cannot stat '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.4/SuiteSparse': No such file or directory                                                                      
cp: cannot stat '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.2/Statistics': No such file or directory                                                                       
cp: cannot stat '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.2/SuiteSparse': No such file or directory                                                                      
cp: cannot stat '/data/projects/programs/julia1.0/julia/usr/share/julia/stdlib/v1.6/SuiteSparse': No such file or directory                                                                      
/data/projects/programs/julia1.0/julia/Makefile:233: recipe for target 'install' failed
make[1]: *** [install] Error 1
make[1]: Leaving directory '/data/projects/programs/julia1.0/julia'
Makefile:426: recipe for target 'binary-dist' failed
make: *** [binary-dist] Error 2

```

---

<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: [February 21, 2022, 1:51pm UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/14 "2022-02-21T13:51:33Z")

</div>

Can you try again on a fresh clone, or after running `make cleanall`? I suspect there are lots of files in there from previous builds (perhaps from older Julia versions, since there are many different version numbers in `/stdlib`).

---

<div class="post-metadata">

### Author: ![Jieyi\_Xiong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jieyi_xiong/32/32032_2.png) [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)
#### Post date: [February 21, 2022, 2:07pm UTC](https://discourse.julialang.org/t/cannot-use-any-package-after-self-compiled-julia-v1-7-distributed/76833/15 "2022-02-21T14:07:08Z")

</div>

`make cleanall` doesn’t solve the problem as I tried before, but compiling on a fresh julia clone is worth trying. I indeed `git pull`ed and `make`ed on the same julia clone in several years for each version update. That might be the problem. Thanks for your suggestion!
