The file pyconfig.h could not open because the include file 'io.h' does not exist in the specified directory

Background:

  • I am completely new to python and Cpp, and I am currently attempting to install a python package called python-crfsuite that requires Visual Studio for compilation.

  • To do this, I have installed Anaconda3 and Python 3.6 within the VS2017 community installer because I believe it offers better functionality due to the compiler it provides: cl.exe.

  • I made sure to run the vcvarsall.bat script before proceeding with any commands, and all of them are executed as an administrator.

Process:

While trying to execute the command pip install python-crfsuite, I encountered the following error message:


C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -Icrfsuite/win32 -Iinclude "-IC:\Program Files\Anaconda3\include" "-IC:\Program Files\Anaconda3\include" /EHsc /Tppycrfsuite/_pycrfsuite.cpp /Fobuild\temp.win-amd64-3.6\Release\pycrfsuite/_pycrfsuite.obj
    _pycrfsuite.cpp
    c:\program files\anaconda3\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

  • In my attempt to resolve this issue, I followed advice provided in a thread on StackOverflow listed here. I tried modifying the system environment paths by replacing specific directories but unfortunately, it did not solve the problem.

  • Subsequently, I downloaded the missing header file io.h and placed it in

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include
    without success.

  • As a last resort, I opted to use the command

    conda install -c conda-forge python-crfsuite
    , which thankfully resulted in a successful installation.

Question

  • Why does using conda install eliminate the issues related to io.h, whereas pip install encounters them?

  • What is the significance of having multiple instances of cl.exe located in various paths within Visual Studio, and how does it impact their functionality?

I pose these questions as despite installing Anaconda, I continue to face challenges when using pip install, and I am still unable to determine the root cause of these obstacles.

Answer №1

Encountered a similar error while installing a package, but managed to resolve it by adding more tools from Visual Studio (specifically using VS 2017 Community and Python 3.6.4). Installed the following tools shown in the installer screenshot here:

  1. Desktop development with C++: Included all default items plus:

    • Windows XP support for C++
    • Support for C++/CLI
    • VC++ 2015.3 v140 toolset
  2. Linux development with C++

Next, opened Windows PowerShell with Administrator privileges (Right click to open), navigated to the Visual Studio installation folder and located this path:

cd [Visual Studio Path]\VC\Auxiliary\Build

Executed the following file:

.\vcvars32.bat

After that, used pip as usual; for example, I installed Mayavi like so:

pip install mayavi

Hopefully, this solution proves helpful to someone else.

Answer №2

When using Windows 10, I found that the 'io.h' file is included with any 'SDK for Windows 10' in the Visual Studio installer (I resolved my issue with SDK version 10.0.20348.0).

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When the FLASK button is triggered, retrieve data from the FLASK and display it

This is a unique test where I will create a button to retrieve information from a MySQL database. However, it's important to first understand this concept. So here is my custom text within the Flask framework: @app.route('/pythonlogin/home', ...

Converting a string dictionary with integer keys into a dictionary

Facing an issue with a specific string: {70: True, 956: False, 727: False} I need to convert this into a dictionary. JSON.loads is not compatible with Integer values in keys. Any suggestions or ideas on how to solve this problem? I have already attempte ...

Selenium with Python: Unmasking the method to choose an option from a dropdown menu even when the element

I'm currently struggling with completing a form on a specific website. To access the form, you can visit: (please click on "filter inmate list", then use the + button to add a row) def coweta_search(last, first): print("Coweta County Jail") ...

Error encountered when executing Selenium WebDriver

Currently in the middle of an online Python course and making progress, but encountering a challenge with pulling HTML data. The TypeError that occurs every time the process finishes has me puzzled. I've followed the instructor's steps closely, y ...

When trying to load the JSON data saved in a JSON file, I encounter an error: JSONDecodeError: Expecting value at line 1, column 1

In this scenario, I am experimenting with saving data in json format to a json file, but encountering issues when trying to load it back. import json # Python objects can be stored in json format value = [ ['sentence one', {'en ...

Determine the relationship between two elements using Xpath within a table on a website

I am currently working with Selenium and Python, so please keep that in mind when providing an answer. My current challenge is to verify that the number indicated by the "green arrow" matches the one shown by the "red arrow". These numbers are generated r ...

When pickle dumps result in producing nonsensical output

Hey there! I've run into a strange issue with my JSON Encoder. When using pickle.dumps(), the output is appearing as: "cdecimal Decimal p0 (S'2097369' p1 tp2 Rp3 .", Instead, it should display: 2097369 This is the code snippet causing the ...

pyOWM is failing to yield the desired outcome

After obtaining my API key, I attempted to integrate the code snippet below: import pyowm owm = pyowm.OWM('API key') mgr = owm.weather_manager() Forecast = mgr.forecast_at_place('London', '3h').forecast max_temperature=[] min ...

Looking for clarification on how to address the following code issue?

for j in range(k_value): print(“Group %d”, % j), for ind in cluster_order[j, :10]: print(‘ %s’ % words[ind]) An error was encountered as shown below for j in range(k_value): print(“Group %d”, % j), for ind in cluster_order[j, :10]: prin ...

Numpy: Executing in-place operations on a dynamic axis

After much consideration, I have tried my best to outline the issue in the title. The problem at hand is the variability of a numpy array's shape or dimension (which can range from 1 to 3). For instance, in the scenario where the array is of shape [1 ...

Retrieve the highest quality image by reading the JSON file from Last.FM

Currently, I am in the process of developing a project that will automatically send a Discord message on specific dates, such as 'Mon 22:00:00'. This message will contain details about my most listened-to album for that week. The code is function ...

Tips for capturing network traffic with Selenium WebDriver and BrowserMob Proxy in Python

For my project, I am working on capturing network traffic using Selenium Webdriver with Python. In order to achieve this, I need to utilize a proxy such as BrowserMobProxy. Everything works smoothly when using webdriver.Chrome: from browsermobproxy impor ...

Retrieve a list of JSON data using the Python requests library

Utilizing the python request module, I am retrieving JSON responses from 3 different servers. The structure of the 2 JSON response are as follows: JSON Response 1: {"MaleName1":"John","MaleAge1":"1.40531900","FemaleName1":"Anna","FemaleAge1":"14"} JSON ...

Exploring the power of Django: Leveraging AJAX requests and utilizing path

I am currently exploring ways to pass variables to a specific JavaScript file that initiates an AJAX request within Django. Assume we have a URL with a path parameter linking to a particular view: url(r'^post/(?P<post_id>\d+)/$', Tem ...

There seems to be an issue with VS Code: the function filter is not working as expected when applied to the result of

Recently, I've encountered a frustrating error in VS Code that is hindering my ability to create new files or open existing ones. The pop-up error message that appears states (this.configurationService.getValue(...) || []).filter is not a function Th ...

Error encountered in Selenium with Python when trying to locate Chrome binary for outdated versions of the browser: WebDriverException - Chrome binary not found

Due to compatibility reasons, I have opted to use Chrome version 55.0.2883.75 with Chromedriver v. 2.26. To download the older version of Chrome, I visited , and for Chromedriver 2.26, I got it from https://chromedriver.storage.googleapis.com/index.html?pa ...

Why won't my cord connect to Django when I try to upload a file?

Having trouble with my file upload code in Django. I followed the example in the documentation but something seems wrong. model.py class OverWriteStorage(FileSystemStorage): def get_available_name(self, name, max_length=None): if self.exists(n ...

Employing Python with Selenium to programmatically click on a button with a ng-click attribute and automatically upload

I am completely new to using Python and Selenium, but I have a task that requires me to automate file uploads with Selenium. There is a button that needs to be clicked which will launch a window for selecting the file to upload. Here is the HTML code fo ...

Refreshing a webpage to accurately display changes made in a CRUD application without the need for a hard reset

My to-do app is almost fully functional - I can create items, mark them as completed, and delete them using a delete button. However, there's one issue: when I delete an item, the page doesn't update in real-time. I have to manually refresh the p ...

Moving a window in Pyqt5 using QtWebChannel

My goal is to enable the mousePressEvent and mouseMoveEvent events in order to move my app window using QtWebChannel. To achieve this, I am utilizing self.setWindowFlags(QtCore.Qt.FramelessWindowHint) to eliminate the default window flag and create a cust ...