2

I don't know if this is the right place to ask this question. I just thought it would be a place where people knew what they are doing. If there is a better place to look for answers (stackoverflow for example), feel free to tell me.

The problem is that .NET can't install iqsharp. It says it doesn't recognize the file even though it is in the PATH folder (user/.dotnet/tools).

> dotnet iqsharp install
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET Core program, but dotnet-iqsharp does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

It shows the same behavior when I want to use other .NET packages. I have dotnet version 3.1.101. I can send dotnet --info if you want.

I have looked on github and other websites for solutions but most of the problems were caused by Linux Ubuntu and most of the treads are still open.

Thanks for reading and I hope you can help me.

Martin Vesely
  • 13,891
  • 4
  • 28
  • 65
BrockenDuck
  • 887
  • 6
  • 26
  • 1
    By way of my understanding, did you run dotnet tool install -g Microsoft.Quantum.IQSharp before running dotnet iqsharp install? The first step makes the IQ# kernel available at the command line, while the second step registers the kernel with Jupyter. – Chris Granade Jan 16 '20 at 21:35
  • Yes I did, the installation was sucessful – BrockenDuck Jan 17 '20 at 06:36
  • why platform are you using? Also I'm not sure, but you might need .net core 3.0.100, support for 3.1.100 should be coming on the next release (end of January). – El capi Jan 17 '20 at 07:14
  • I use windows 10, I didn't see on the documentation .net core 3..1 wasn't supported. On the documentation it just says .NET Core SDK 3.0 or later. Are you sure it will be released on the end of January, I cannot afford to wait more than that ? – BrockenDuck Jan 17 '20 at 07:47
  • You mentioned that you observe the same behavior when you want to use other .NET packages? Following up on that, can you double-check if youuse any other .NET Core Global Tools? For instance, dotnet tool install -g dotnet-format should make the command dotnet-format available on $PATH; can you run that and check that which dotnet-format works? – Chris Granade Jan 17 '20 at 17:02
  • It successfully installed dotnet-format and I can the see the tool in the $PATH (User/.dotnet/tools) but when I try dotnet-format it tells me that it is not recognized as a command. I am on windows so I understand that whichshould be where. Strangely the the search returns nothing even though the executable is in in the correct folder and the path to the folder is in the PATH variable ($env:USERPROFILE/.dotnet/tools). I do not really know what you mean with .NET Core Global Tools but I just installed dotnet for q# and have only installed cowsay, format and iqsharp. – BrockenDuck Jan 17 '20 at 18:16
  • Thanks for the clarification, that helps a lot! By the way, ".NET Core Global Tools" is the name of the dotnet tool feature; IQ#, dotnet-format and dotnet-cowsay are all examples of Global Tools (more docs at https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools).

    Anyway, if your shell environment (looks like you're using PowerShell from the $env: notation?) can't find any Global Tools, that does suggest a problem with $Env:PATH. It's a bit confusing, since you said $Env:PATH contains the .dotnet/tools folder under your home folder.

    – Chris Granade Jan 17 '20 at 19:06
  • @ChrisGranade I found the answer, there is something wrong with my PATH variable. I do not now why but in the path is written in UNIX encoding and not windows : env:PATH and env:USERPROFILE/.dotnet/tools are the problematic paths. I did the instalation normally but something must have gone wrong. How can I fix it ? For this I have to change the PATH environment variable. Any tips ? – BrockenDuck Jan 17 '20 at 21:51
  • Glad you found the answer! I'm afraid I could only guess at how that happened, sorry, but as for how to fix it, from the Start Menu type "Edit the system environment variables." From there, press the Environment Variables... button on the lower-right. Double-clicking either the PATH variable for your account or the system will bring up a paths editor that will let you fix that variable. You'll just need to make sure that your .dotnet/tools is on your user path. After editing, relaunch your shell and it should work. – Chris Granade Jan 17 '20 at 22:48
  • @ChrisGranade I think it is actually linux path but actually powershell. In this case it makes a lot more sense. I now have to choose to which environment I want to install q#. The only I have currently installed is jupyter, but I don't want to create notebooks with it. I now have to choose between a conda environment and a viretual environment. Do you have any tips ? – BrockenDuck Jan 18 '20 at 14:18

2 Answers2

1

Go to Pycharm or VS Code and in console do write this command pip install qsharp . It works well.

0

Basicaly what happened is that dotnet didn't add itself to path. Path is an environment variable which is basically a list of paths to find executable. You can see it by simply typing PATH in the command prompt. You have to add the path to your dotnet tools which should be %USERPROFILE%/.dotnet/tools in the control panel. Look on the internet about how to do it, there are plenty tutorials. The problem should be solved.

BrockenDuck
  • 887
  • 6
  • 26