Steps to reproduce:
I created a new project in Visual Studio
Selected Python > Desktop > "IronPython Windows Forms Application"
However, as soon as I open the project I encountered several errors which I don't know how to solve. The errors are unresolved import clr an similar.
If you're getting the following error unable to resolve 'clr':
It's likely that you don't have a python interpreter installed or configured for Visual Studio
Per the question The environment ironpython 2.7-32 appears to be incorrectly configured or missing
The Visual Studio Installer does not include an IronPython Package option to install
So you need to:
Download IronPython from Github and install it
Then, select the correct Python environment within your VS project.
Related
I cannot get certain imports to work in Python, in Visual Studio, on Windows 10. I installed them using the command:
python -m pip install scikit-learn
and it says they are saved to:
c:\users\[My Name]\appdata\local\programs\python\python35-32\lib\site-packages
However, when I try to use them in the program I get the error:
Unable to resolve "sklearn". IntelliSense may be missing for this module.
Originally I thought the problem was because I have two hard drives, but both the Python application and Visual Studio are also saved to the C drive. What should I do from here?
I'm a newbie to Python environment & really struggling to install SIP & PyQt on my Win 7 machine.
This is what I've done so far,
I've downloaded SIP-4.16.9 and extracted files from the zip folder
The extracted folder is then copied to C:\Python34\Lib
Launched a command prompt(cmd) and changed path to C:\Python34\Lib
Then when I entered python configure.py at C:\Python34\Lib and I get the response as below
At this stage I'm not sure whether it's been installed successfully, to verify I looked for SIP.h at C:\Python34\Include(according to above response - in red), but I cant find any such header file, so I assume the installation hasn't been successful.
Could any one help me, what am I missing here?
Additional System Info:
Windows 7 64 Bit
Python 3.4
Environment Variable (Path : C:\Python34;C:\Python34\Lib;C:\Python34\Lib\site-packages)
Note: There are several questions posted before, but none of them helped so far, I'm sure I must be missing something silly.
Thanks for your time.
For next users who need to build sip (or pyqt) in windows using sources
ALL these instructions are for 32-bits, it will work even if you have a 64-bit system.
For Qt 5.9.x :
Since Qt 5.9, there is only one version of Qt downloadable for Windows that includes the pre-built components for MSVC201x and MinGW.
The instructions follow the same steps as for Qt 5.8
Since Microsoft Visual Studio 2015 Community Edition is not available to download anymore, next users should use Microsoft Visual Studio 2017 Community Edition with Qt 5.9 and follow the same instructions below.
Microsoft Visual Studio 2017 Community Edition (32-bits)
https://www.visualstudio.com/downloads/
Qt 5.9.x
http://download.qt.io/archive/qt/
When Installing Qt, make sure to select the correct pre-built components you have (for e.g Microsoft Visual Studio 2017)
For Qt 5.8 and earlier :
Downloads
Download Python 3.6.x (32-bits) any version will do it :
https://www.python.org/downloads/
(if you also have python 2.7, make sure to use verions 3 of python)
Download sources for sip and PyQt5: Under "Source Packages", download the "Windows Source"
https://www.riverbankcomputing.com/software/sip/download
https://www.riverbankcomputing.com/software/pyqt/download5
Microsoft Visual Studio 2015 Community Edition (32-bits)
https://www.microsoft.com/en-us/download/details.aspx?id=48146
Qt 5.8.0 for Windows 32-bit (VS 2015, 1.0 GB)
http://download.qt.io/archive/qt/
Qt download link must match the Visual Studio (VS) version installed (here VS 2015) and the PyQt5 version you need to install
For example:
PyQt5.8.2
Qt5.8.0 (Link for VS 2015)
Microsoft Visual Studio 2015
Compilation
Open a terminal and stay on it.
It is important you stay on the same terminal (cmd.exe) during the whole process so you don't have to source your environment twice.
Let's create an environment to compile PyQt and SIP (in order to compile PyQt, you need first to compile sip)
Create a folder "compilation" in your Desktop for example:
Extract the content of your sip archive in this forlder
Extract the content of your PyQt5 archive in this forlder
You should have now :
.
├── compilation
| ├── sip-4.19.2/
| └── PyQt5_gpl-5.8.2/
Make sure you are using Python 3.x:
1 - SIP
Go to sip-4.19.2 folder and run :
python configure.py
At this step, you did not install sip, you only configured it (basically its installation dir, etc...)
VERY IMPORTANT STEP: source your environment variables by running in the terminal :
Keep the double quotes, windows does not like spaces ...
"C:\Qt\Qt5.8.0\5.8\msvc2015\bin\qtenv2.bat"
After running this command, it automatically change your current directory, stay on the terminal and re-go to your sip-4.19.2 directory and run:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
In windows, "make" is substituted by "nmake" !
Then (always in the same terminal) you run :
nmake
[...]
nmake install
This will create a sip.exe in your Python dir, for me it is C:\Python36, it may elsewhere, depending on where you installed Python.
2 - PyQt5
The steps are almost the same as sip but it will take more time.
Go to PyQt5_gpl-5.8.2 folder and run :
python configure.py --disable QtNfc --confirm-license
Note that this command disable QtNfs because of a compilation problem I could not resolve.. and automatically accepts the license.
Then, run (the compilation will take a while) :
nmake
nmake install
Hope this helps.
There's a ONE SHOT solution to all your installation problems on Windows. Go to this website. http://www.lfd.uci.edu/~gohlke/pythonlibs/. Navigate to the library you want and download the .whl file for your python version and your computer (32 or 64 bit.) Then run pip install YourWhlFileName.whl, and you're done! (CAUTION: MAKE SURE NOT TO CHANGE THE NAME OF THE WHL FILE OR IT WON'T WORK.)
This is for all that want to build PyQt4 with latest Qt4 and Python 3.4.x.
Download Visual Studio 2010 from here:
http://download.cnet.com/Microsoft-Visual-Studio-2010-Ultimate/3000-2383_4-75450998.html
then install it.
Download SIP source code (in my case version 4.19.5) from here:
https://www.riverbankcomputing.com/software/sip/download
Download PyQt4 source code (in my case version 4.12.1) from here:
https://www.riverbankcomputing.com/software/pyqt/download
Extract SIP and PyQt .zip archive in \Users\your_username\Desktop\compilation\
Download latest Qt 4.x (vs2010 version) installer from here:
http://download.qt.io/archive/qt/
Install Qt (in my case qt-opensource-windows-x86-vs2010-4.8.6.exe).
Open a command prompt (use this one for all the process) and execute these commands:
cd \Users\<your_username>\Desktop\compilation\sip-4.19.5
python configure.py
"C:\Qt\4.8.6\bin\qtvars.bat"
In the output take note of QMAKESPEC value, in my case win32-msvc2010, then use it later on --spec option for PyQt4 configure-ng script.
If the current directory has been changed, execute again:
cd \Users\<your_username>\Desktop\compilation\sip-4.19.5
Now, if you use 64-bit version of Python execute:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
otherwise, if you use 32-bit version of Python execute:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
nmake
nmake install
cd \Users\<your_username>\Desktop\compilation\PyQt4_gpl_win-4.12.1
Now use previous QMAKESPEC value in --spec option:
python configure-ng.py --spec win32-msvc2010
nmake
nmake install
That's all ;-)
NOTE: in some cases, in order to avoid this error
ImportError: DLL load failed: The specified procedure could not be found.
it is necessary to copy .dll files from
C:\Qt\4.8.6\bin
to
C:\Python34\Lib\site-packages\PyQt4
Like many before me I don´t succeed in installing a few Python packages (mysql, pycld2, etc.) on Windows. I have a Windows 8 machine, 64-bit, and Python 3.4. At first I got the well-known error "can´t find vcvarsall.bat - install VS C++ 10.0". This I tried to solve by installing MinGW and use that as compiler. This did not work. Then finally I found an installer for this VS C++ 10.0 here http://microsoft-visual-cpp-express.soft32.com/free-download/. This doesn´t work too good either. Now it seems to find the vcvarsall file but instead gives me a couple of new errors
nclude -IC:\Python34\include /Tc_mysql.c /Fobuild\temp.win32-3.4\Release\_mysql.
obj /Zl_mysql.c_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':
No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2
And:
pycldmodule.cc
bindings\pycldmodule.cc(16) : fatal error C1083: Cannot open include file: '
strings.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2
So now it doesn´t find strings.h and config-win.h and I´m too new to these sorts of problems to know what to look for. Anyone knows what I should do?
The thing is that I could just not use Windows and go over to Ubuntu as, for what I´ve understood, works painlessly with python. However, I have to use the win32com package which doesn´t exist on Ubuntu (have I understood that right?).
If I can´t solve these installing hassles on Windows, would a solution be to use a Windows virtual machine for the win32com part and do the rest on a host Ubuntu (or the other way around)? Would there be anyway to communicate between the two in that case? I.e. sending strings or arrays of data.
I have faced the exact same issues for Python 2.7 on 64 bit Windows trying to install pycld2.
Tried many methods like installing VS express 2008, MingW, etc and it just doesnt work.
What saved me is this link:
https://github.com/aboSamoor/polyglot/issues/11
The proposed solution is to download the binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and pip install .whl
The cpXX denotes the version of python. So in my case, I used cp27.
Hope it helps
I would recommend installing Ubuntu (as a Ubuntu user), you can dual-boot. However, that isn't an answer.
MySQLClient (the fork for Python3) is available a precompiled binary from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
Try to find precompiled binaries for simplicity sake. As far as troubleshooting the install goes, I've tried the recommend VC Studio 9.0 on fresh installs and it cannot find stdint.h (which, like yours, suggests it's more than broken).
You could try http://www.activestate.com/activepython/downloads for Windows. I t includes compiled binaries, avoiding the need for a C complier.
I grew frustrated with trying to get python and other packages to compile/play nicely on Windows as well. Switching over to Ubuntu was a breath of fresh air, for sure.
The win32com package is made specifically for Windows hosts, so that could not longer be used, but there are other ways to achieve the same thing in Ubuntu.
Are you trying to target Windows specifically? What are you using win32com for?
Looks like you're missing MySQL dev package. Another StackOverflow question has the details. But if I were you, I'd go the route Alexander Huszagh recommended and get my precompiled binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
I', trying to compile a Python modules on Windows 7 ( Python 3.3 ) and getting the error: Unable to find vcvarsall.bat which i read around is related to not having Visual Studio 2008 installed. Bu i have visual studio 2008 installed AND it's in the path, any ideas?
EDIT - i also checked How do I point easy_install to vcvarsall.bat? but no effects, i tried setting the variable but it's ignored.
EDIT 2 - I've found out by looking at the core that it's now looking for VS100COMNTOOLS instead of VS90COMNTOOLS is the VS studio version different?
Python 3.3 on Windows is built with VS2010, which doesn't match your VS2008. Previous versions of Python did indeed use VS2008.
You'll need to get hold of VS2010.
I've installed ActivePython 2.7.2 and I'm trying to execute a .pys script via the console with wscript/cscript, [i.e. ActivePython (PythonScript with .pys extension) in Microsoft's WSH(Windows Scripting Host)] and when trying with wscript I get two errors.
"The program cannot start because MSVCR90.dll is missing from your computer try reinstalling the program to fix this problem"
"Can't find script engine Python for script
I did some googling and have also downloaded and installed the Microsoft Visual C++ Redistributable Package (x86) from here: http://www.microsoft.com/download/en/confirmation.aspx?id=29 to no avail.
I've tried 'pythonw c:\Python27\Lib\site-packages\win32comext\axscript\client\pyscript.py'
to register python.
Any help would be greatly appreciated.
I'm running on Win7 x86.
To fix this:
Install Python for Windows Extensions (PyWin32)
Register python, C:\YourPythonVersion\Lib\site-packages\win32comext\axscript\client\pyscript.py