# Q# Quantum.MachineLearning namespace doesn't exist error

I am trying to use the HalfMoon Classifier in Quantum Machine Learning Sample Examples. I am trying to run it locally. However I keep getting this error.

No namespace with the name "Microsoft.Quantum.MachineLearning" exists.


This error is then followed by multiple errors of the identifiers under this namespace not existing. In my python Host.py file

I have the following Import Lines

import qsharp



Edit:

Replacing Package Version and Making it same as dotnet iqsharp --version did work. However I still seem to getting fail: warnings saying identifiers don't exist and

No namespace with the name "Microsoft.Quantum.MachineLearning" exists.


The program runs correctly but the warnings don't go away. Hence I ask is there anyway to fix these warnings?

• What version of the IQ# kernel do you have installed? (Run dotnet iqsharp --version to see.) Make sure the version of the package you specify in your code matches this. Jun 13 '20 at 11:20
• @RyanShaffer I tried this but it didn't work Jun 13 '20 at 11:28
• Are you running the sample as is, without any modifications? Does it build and run if you run it from command line using "dotnet run"? Jun 13 '20 at 18:14
• Thanks for your question! If I could get some additional diagnostic info, that would really help figure out what went wrong. When you ran qsharp.reload(), did that print any error messages to the console? What's the output of qsharp.component_versions()? If you could also try running the same snippet, but with the IQSHARP_LOG_LEVEL environment variable set to Debug, that would really help as well. Thanks! Jun 13 '20 at 18:30
• I apologize to @RyanShaffer. His fix actually did work. However apparently, q# first goes into a preparing q# environment. Resulting in repeated errors about lack of identifiers from the Microsoft.Quantum.MachineLearning Namespace. However later when I simulate the model training and validation. They run correctly. I will edit the question to ask how to get rid of the fail: statement. Jun 14 '20 at 10:18