3

I was trying to get several packages with Pkg.add("Statsbase"), but I am always getting the following error. It does the same error with any other function I have tried with Pkg. Does anyone know how to resolve this? I am using VSCode Julia plugin.

I saw that in the past locating and deleting manifest_usage.toml file helped, however I couldn't find such file in logs.

ERROR: Could not parse project: TOML Parser error:
C:\Users\knirs\AppData\Roaming\Microsoft\Windows\Start Menu\Julia 1.8.2.lnk:1:2 error: invalid bare key character: '\0'
  L���☺¶☻������������F���� �����9w6��☺�K:w6��☺�@↑J‼���☻�����☺���������������p☻:�▼DG→♥Yr?�D��U��k0�&�☺�&��►���∟q�Q|��☺��7)}��☺��rQ6��☺¶���t�∟�CFSF▬�1�����CUs�↕�AppData���t→Y^���H�g↨3��(����ߟgVA�G��k6@�    �♦��CUh�DU��.���CL∟���♦���������������8w��A�p�p�D�a�t�a���B�P�1�����DU�x►�Local�<�      �♦��CUh�DU��.���R�∟���♣���������������↑�w�L�o�c�a�l���¶�Z�1�����DU�►�Programs��B�   �♦��wRr�DU�.����#♦���
���������������U#��J�u�l�i�a�-�1�.�8�.�2���→�J�1�����DU�►�bin�8��       �♦��DU�DU�.����F↔���♠���������������↑���b�i�n���↕�\�2�☻�=U�v �julia.exe�D� �♦��DU�DU�.���B> ���☺�������������������j�u�l�i�a�.�e�x�e���↑���u���∟���☺���∟���4�������t���↑���♥���F�¶Z►���Windows�C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\bin\julia.exe��4�.�.�\�.�.�\�.�.�\�.�.�\�L�o�c�a�l�\�P�r�o�g�r�a�m�s�\�J�u�l�i�a�-�1�.�8�.�2�\�b�i�n�\�j�u�l�i�a�.�e�x�e��C�:�\�U�s�e�r�s�\�k�n�i�r�s�∟���
���|��☺I�J�H��K♦�:���`���♥���X�������desktop-ief50ks�x�↓�c��A��bg�l�8k��♦
D�◄������↓♣x�↓�c��A��bg�l�8k��♦
D�◄������↓♣���� �������1SPS�XF�L8C��‼�&�m�m���♦����▼���.���S�-�1�-�5�-�2�1�-�1�9�9�8�2�8�7�2�4�1�-�3�8�1�2�7�2�7�6�6�-�2�3�2�8�8�7�6�3�2�9�-�1�0�0�1�������9���1SPS�▬mD��pH�H@.�=x�↔���h����H���.▬��MA����'冑������������
   ^                                                                                                                                                
                                                                                                                                                                                                                                                                                            

Stacktrace:
  [1] pkgerror(::String, ::Vararg{String})
    @ Pkg.Types C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\Types.jl:67
  [2] read_project(f_or_io::String)
    @ Pkg.Types C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\project.jl:138
  [3] Pkg.Types.EnvCache(env::Nothing)
    @ Pkg.Types C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\Types.jl:328
  [4] EnvCache
    @ C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\Types.jl:325 [inlined]
  [5] Pkg.Types.Context()
    @ Pkg.Types .\util.jl:493
  [6] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:147
  [7] add(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:145
  [8] #add#27
    @ C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:144 [inlined]
  [9] add
    @ C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:144 [inlined]
 [10] #add#26
    @ C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:143 [inlined]
 [11] add(pkg::String)
    @ Pkg.API C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:143
 [12] top-level scope
    @ REPL[2]:1

caused by: TOML Parser error:
C:\Users\knirs\AppData\Roaming\Microsoft\Windows\Start Menu\Julia 1.8.2.lnk:1:2 error: invalid bare key character: '\0'
  L���☺¶☻������������F���� �����9w6��☺�K:w6��☺�@↑J‼���☻�����☺���������������p☻:�▼DG→♥Yr?�D��U��k0�&�☺�&��►���∟q�Q|��☺��7)}��☺��rQ6��☺¶���t�∟�CFSF▬�1�����CUs�↕�AppData���t→Y^���H�g↨3��(����ߟgVA�G��k6@�    �♦��CUh�DU��.���CL∟���♦���������������8w��A�p�p�D�a�t�a���B�P�1�����DU�x►�Local�<�      �♦��CUh�DU��.���R�∟���♣���������������↑�w�L�o�c�a�l���¶�Z�1�����DU�►�Programs��B�   �♦��wRr�DU�.����#♦���
���������������U#��J�u�l�i�a�-�1�.�8�.�2���→�J�1�����DU�►�bin�8��       �♦��DU�DU�.����F↔���♠���������������↑���b�i�n���↕�\�2�☻�=U�v �julia.exe�D� �♦��DU�DU�.���B> ���☺�������������������j�u�l�i�a�.�e�x�e���↑���u���∟���☺���∟���4�������t���↑���♥���F�¶Z►���Windows�C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\bin\julia.exe��4�.�.�\�.�.�\�.�.�\�.�.�\�L�o�c�a�l�\�P�r�o�g�r�a�m�s�\�J�u�l�i�a�-�1�.�8�.�2�\�b�i�n�\�j�u�l�i�a�.�e�x�e��C�:�\�U�s�e�r�s�\�k�n�i�r�s�∟���
���|��☺I�J�H��K♦�:���`���♥���X�������desktop-ief50ks�x�↓�c��A��bg�l�8k��♦
D�◄������↓♣x�↓�c��A��bg�l�8k��♦
D�◄������↓♣���� �������1SPS�XF�L8C��‼�&�m�m���♦����▼���.���S�-�1�-�5�-�2�1�-�1�9�9�8�2�8�7�2�4�1�-�3�8�1�2�7�2�7�6�6�-�2�3�2�8�8�7�6�3�2�9�-�1�0�0�1�������9���1SPS�▬mD��pH�H@.�=x�↔���h����H���.▬��MA����'冑������������
   ^                                                                                                                                                
                                                                                                                                                                                                                                                                                   

Stacktrace:
  [1] parse
    @ .\toml_parser.jl:441 [inlined]
  [2] Base.CachedTOMLDict(p::Base.TOML.Parser, path::String)
    @ Base .\loading.jl:222
  [3] (::Base.var"#894#895"{String, Base.TOMLCache})()
    @ Base .\loading.jl:277
  [4] lock(f::Base.var"#894#895"{String, Base.TOMLCache}, l::ReentrantLock)
    @ Base .\lock.jl:185
  [5] parsed_toml
    @ .\loading.jl:274 [inlined]
  [6] parse_toml
    @ C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\Types.jl:58 [inlined]
  [7] read_project(f_or_io::String)
    @ Pkg.Types C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\project.jl:134
  [8] Pkg.Types.EnvCache(env::Nothing)
    @ Pkg.Types C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\Types.jl:328
  [9] EnvCache
    @ C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\Types.jl:325 [inlined]
 [10] Pkg.Types.Context()
    @ Pkg.Types .\util.jl:493
 [11] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:147
 [12] add(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:145
 [13] #add#27
    @ C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:144 [inlined]
 [14] add
    @ C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:144 [inlined]
 [15] #add#26
    @ C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:143 [inlined]
 [16] add(pkg::String)
    @ Pkg.API C:\Users\knirs\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\Pkg\src\API.jl:143
 [17] top-level scope
    @ REPL[2]:1
Adam Knirsch
  • 443
  • 1
  • 6
  • 16
  • 1
    Do you get the error starting Julia from a command line session and typing ]add StatsBase in the REPL session? If that works without the error you may need to reinstall VS Code and/or its Julia plugin. – Bill Oct 06 '22 at 22:58
  • It looks like it's trying to parse the `.lnk` file (the Julia shortcut in the Start Menu) itself as if it was a `Project.toml` file. That's pretty weird! If you don't have any packages installed so far, delete the `Project.toml` file from the currently open environment and then try again. – Sundar R Oct 07 '22 at 01:59
  • @Bill yes, it seems to work outside VSCode. I will try that then. – Adam Knirsch Oct 07 '22 at 07:05
  • So, adding packages through the Julia command line is one of the solutions to the problem, because then everything worked. – Adam Knirsch Oct 07 '22 at 07:24

1 Answers1

0

I found 2 ways to get around this.

The first way was to use the Julia cli outside vscode to install packages.

The other way was to install the Jupyter extension inside vscode along with the Julia extension from the marketplace. Then add the location of the julia exe file into the vscode -> Preferences -> Settings -> Julia: Executable Path location line.

Then create a new file called something.ipynb like how you create a normal python jupyter notebook, but now instead select the Julia interpreter.

I was able to run the following command in a cell successfully. I also have had no errors with StatsBase and other packages so far using the Jupyter notebook method within vscode.

import Pkg
Pkg.add("Flux")

After the installation bars, I got the message,

...
...
  ✓ MLUtils
 ✓ OneHotArrays  ✓ CUDA
 ✓ NNlibCUDA  ✓ Flux
  80 dependencies successfully precompiled in 78 seconds (22 already precompiled)

Have attached a screenshot of another example below.

Julia installing Gen

anarchy
  • 3,709
  • 2
  • 16
  • 48