ProjectQ-Framework / ProjectQ

ProjectQ: An open source software framework for quantum computing
https://projectq.ch
Apache License 2.0
888 stars 274 forks source link

Unable to install projectq using pip #335

Closed juraskumar closed 5 years ago

juraskumar commented 5 years ago

Hi. I have been trying to install projectq on Windows using pip install. when using the command: pip install projectq I get the following error. ` Traceback (most recent call last): File "", line 1, in File "C:\Users\pc\AppData\Local\Temp\pip-install-jiybociz\projectq\setup.py", line 171, in packages=find_packages() File "c:\users\pc\anaconda3\lib\distutils\core.py", line 148, in setup dist.run_commands() File "c:\users\pc\anaconda3\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "c:\users\pc\anaconda3\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "c:\users\pc\anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\setuptools\command\install.py", line 61, in run File "c:\users\pc\anaconda3\lib\distutils\command\install.py", line 545, in run self.run_command('build') File "c:\users\pc\anaconda3\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\users\pc\anaconda3\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "c:\users\pc\anaconda3\lib\distutils\command\build.py", line 135, in run self.run_command(cmd_name) File "c:\users\pc\anaconda3\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "c:\users\pc\anaconda3\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "c:\users\pc\anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg\setuptools\command\build_ext.py", line 77, in run File "c:\users\pc\anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 185, in run _build_ext.build_ext.run(self) File "c:\users\pc\anaconda3\lib\distutils\command\build_ext.py", line 339, in run self.build_extensions() File "C:\Users\pc\AppData\Local\Temp\pip-install-jiybociz\projectq\setup.py", line 109, in build_extensions self.warning("Something is wrong with your C++ compiler.\n" File "C:\Users\pc\AppData\Local\Temp\pip-install-jiybociz\projectq\setup.py", line 151, in warning raise Exception(warning_text + "\nCould not install the C++-Simulator." Exception: Something is wrong with your C++ compiler. Failed to compile a simple test program!

Could not install the C++-Simulator.
ProjectQ will default to the (slow) Python simulator.
Use --without-cppsimulator to skip building the (faster) C++ version of the simulator.
----------------------------------------

ERROR: Command errored out with exit status 1: 'c:\users\pc\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\pc\AppData\Local\Temp\pip-install-jiybociz\projectq\setup.py'"'"'; file='"'"'C:\Users\pc\AppData\Local\Temp\pip-install-jiybociz\projectq\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\pc\AppData\Local\Temp\pip-record-mkr2dw6a\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output. `

juraskumar commented 5 years ago

I have also tried installing without the simulator using `(C:\Users\pc\Anaconda3) C:\Users\pc>python -m pip install --user --global-option=--without-cppsimulator .

C:\Users\pc\Anaconda3\lib\site-packages\pip_internal\commands\install.py:243: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options. cmdoptions.check_install_build_global(options) ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.`

Takishima commented 5 years ago

To install without the C++ simulator, you should not include a period at the end of your pip command:

python -m pip install --user --global-option=--without-cppsimulator projectq
Takishima commented 5 years ago

According to the error message above, the installation process cannot find a working C++ compiler. Do you have Visual Studio or the Visual Studio Build Tools installed on your computer?

juraskumar commented 5 years ago

Hi thanks for the comment about the period. After trying that out, I have installed projectq without the simulator. However i wish to still get the simulator version. I have installed Visual Studio Build Tools 2019 on my computer (version 16.2.4). So i am not sure why I cant get the faster version of projectq installed. Should i do something more than installing Build Tools?

Takishima commented 5 years ago

You probably need to have the Windows SDK installed as well.

Takishima commented 5 years ago

Were you able to solve your problem? If not, what is holding you at the moment?

Takishima commented 5 years ago

I'll be closing the issue since it is inactive. Feel free to open a new one if the problem persists.