Git Product home page Git Product logo

pyreadr's Introduction

pyreadr

A python package to read and write R RData and Rds files into/from pandas dataframes. It does not need to have R or other external dependencies installed.

It can read mainly R data frames and tibbles. Also supports vectors, matrices, arrays and tables. R lists and R S4 objects (such as those from Bioconductor) are not supported. Please read the Known limitations section and the section on what objects can be read for more information.

This package is based on the librdata C library by Evan Miller and a modified version of the cython wrapper around librdata jamovi-readstat by the Jamovi team.

Detailed documentation on all available methods is in the Module documentation

If you would like to read SPSS, SAS or STATA files into python in an easy way, take a look to pyreadstat, a wrapper around the C library ReadStat.

Moving from R to Python and fighting against indentation issues? Missing curly braces? Missing the <- operator for assignment? Then try PytwisteR! Python with a twist of R! (note: it works, but it's only a joke)

Table of Contents

Dependencies

The package depends on pandas, which you normally have installed if you got Anaconda (highly recommended.) If creating a new conda or virtual environment or if you don't have it in your base installation, pandas should get installed automatically.

If you are reading 3D arrays, you will need to install xarray manually. This is not installed automatically as most users won't need it.

In order to compile from source, you will need a C compiler (see installation) and cython (version >= 0.28).

librdata also depends on zlib, bzip2 and lzma; it was reported not to be installed on Lubuntu or docker base ubuntu images. If you face this problem intalling the libraries solves it.

Installation

Using pip

Probably the easiest way: from your conda, virtualenv or just base installation do:

pip install pyreadr

If you are running on a machine without admin rights, and you want to install against your base installation you can do:

pip install pyreadr --user

We offer pre-compiled wheels for Windows, linux and macOs.

Using conda

The package is also available in conda-forge for windows, mac and linux 64 bit.

In order to install:

conda install -c conda-forge pyreadr 

From the latest sources

Download or clone the repo, open a command window and type:

python3 setup.py install

If you don't have admin privileges to the machine do:

python3 setup.py install --user

You can also install from the github repo directly (without cloning). Use the flag --user if necessary.

pip install git+https://github.com/ofajardo/pyreadr.git

You need a working C compiler and cython. You may also need to install bzlib (on ubuntu install libbz2-dev).

In order to run the tests:

python tests/test_basic.py

You can also install and test in place with:

python setup.py build_ext --inplace
python tests/test_basic.py --inplace

Usage

Basic Usage: reading files

Pass the path to a RData or Rds file to the function read_r. It will return a dictionary with object names as keys and pandas data frames as values.

For example, in order to read a RData file:

import pyreadr

result = pyreadr.read_r('test_data/basic/two.RData')

# done! let's see what we got
print(result.keys()) # let's check what objects we got
df1 = result["df1"] # extract the pandas data frame for object df1

reading a Rds file is equally simple. Rds files have one single object, which you can access with the key None:

import pyreadr

result = pyreadr.read_r('test_data/basic/one.Rds')

# done! let's see what we got
print(result.keys()) # let's check what objects we got: there is only None
df1 = result[None] # extract the pandas data frame for the only object available

Here there is a relation of all functions available. You can also check the Module documentation.

Function in this package Purpose
read_r reads RData and Rds files
list_objects list objects and column names contained in RData or Rds file
download_file download file from internet
write_rdata writes RData files
write_rds writes Rds files

Basic Usage: writing files

Pyreadr allows you to write one single pandas data frame into a single R dataframe and store it into a RData or Rds file. Other python or R object types are not supported. Writing more than one object is not supported.

import pyreadr
import pandas as pd

# prepare a pandas dataframe
df = pd.DataFrame([["a",1],["b",2]], columns=["A", "B"])

# let's write into RData
# df_name is the name for the dataframe in R, by default dataset
pyreadr.write_rdata("test.RData", df, df_name="dataset")

# now let's write a Rds
pyreadr.write_rds("test.Rds", df)

# done!

now you can check the result in R:

load("test.RData")
print(dataset)

dataset2 <- readRDS("test.Rds")
print(dataset2)

By default the resulting files will be uncompressed, you can activate gzip compression by passing the option compress="gzip". This is useful in case you have big files.

import pyreadr
import pandas as pd

# prepare a pandas dataframe
df = pd.DataFrame([["a",1],["b",2]], columns=["A", "B"])

# write a compressed RData file
pyreadr.write_rdata("test.RData", df, df_name="dataset", compress="gzip")

# write a compressed Rds file
pyreadr.write_rds("test.Rds", df, compress="gzip")

Reading files from internet

Librdata, the C backend of pyreadr absolutely needs a file in disk and only a string with the path can be passed as argument, therefore you cannot pass an url to pyreadr.read_r.

In order to help with this limitation, pyreadr provides a funtion download_file which as its name suggests downloads a file from an url to disk:

import pyreadr

url = "https://github.com/hadley/nycflights13/blob/master/data/airlines.rda?raw=true"
dst_path = "/some/path/on/disk/airlines.rda"
dst_path_again = pyreadr.download_file(url, dst_path)
res = pyreadr.read_r(dst_path)

As you see download_file returns the path where the file was written, therefore you can pass it to pyreadr.read_r directly:

import pyreadr

url = "https://github.com/hadley/nycflights13/blob/master/data/airlines.rda?raw=true"
dst_path = "/some/path/on/disk/airlines.rda"
res = pyreadr.read_r(pyreadr.download_file(url, dst_path), dst_path)

Reading selected objects

You can use the argument use_objects of the function read_r to specify which objects should be read.

import pyreadr

result = pyreadr.read_r('test_data/basic/two.RData', use_objects=["df1"])

# done! let's see what we got
print(result.keys()) # let's check what objects we got, now only df1 is listed
df1 = result["df1"] # extract the pandas data frame for object df1

List objects and column names

The function list_objects gives a dictionary with object names contained in the RData or Rds file as keys and a list of column names as values. It is not always possible to retrieve column names without reading the whole file in those cases you would get None instead of a column name.

import pyreadr

object_list = pyreadr.list_objects('test_data/basic/two.RData')

# done! let's see what we got
print(object_list) # let's check what objects we got and what columns those have

Reading timestamps and timezones

R Date objects are read as datetime.date objects.

R datetime objects (POSIXct and POSIXlt) are internally stored as UTC timestamps, and may have additional timezone information if the user set it explicitly. If no timezone information was set by the user R uses the local timezone for display.

librdata cannot retrieve that timezone information, therefore pyreadr display UTC time by default, which will not match the display in R. You can set explicitly some timezone (your local timezone for example) with the argument timezone for the function read_r

import pyreadr

result = pyreadr.read_r('test_data/basic/two.RData', timezone='CET')

if you would like to just use your local timezone as R does, you can get it with tzlocal (you need to install it first with pip) and pass the information to read_r:

import tzlocal
import pyreadr

my_timezone = tzlocal.get_localzone().zone
result = pyreadr.read_r('test_data/basic/two.RData', timezone=my_timezone)

If you have control over the data in R, a good option to avoid all of this is to transform the POSIX object to character, then transform it to a datetime in python.

When writing these kind of objects pyreadr transforms them to characters. Those can be easily transformed back to POSIX with as.POSIXct/lt (see later).

What objects can be read and written

Data frames composed of character, numeric (double), integer, timestamp (POSIXct and POSIXlt), date, logical atomic vectors. Factors are also supported.

Tibbles are also supported.

Atomic vectors as described before can also be directly read and are translated to a pandas data frame with one column.

Matrices, arrays and tables are also read and translated to pandas data frames (because those objects in R can be named, and plain numpy arrays do not support dimension names). The only exception is 3D arrays, which are translated to a xarray DataArray (as pandas does not support more than 2 dimensions). This is also the only time that an object different from a pandas dataframe is returned by read_r.

For 3D arrays, consider that python prints these in a different way as R does, but still you are looking at the same array (see for example here for an explanation.)

Only single pandas data frames can be written into R data frames.

Lists and S4 objects (such as those coming from Bioconductor are not supported. Please read the Known limitations section for more information.

More on writing files

For converting python/numpy types to R types the following rules are followed:

Python Type R Type
np.int32 or lower integer
np.int64, np.float numeric
str character
bool logical
datetime, date character
category depends on the original dtype
any other object character
column all missing logical
column with mixed types character
  • datetime and date objects are translated to character to avoid problems with timezones. These characters can be easily translated back to POSIXct/lt in R using as.POSIXct/lt. The format of the datetimes/dates is prepared for this but can be controlled with the arguments dateformat and datetimeformat for write_rdata and write_rds. Those arguments take python standard formatting strings.

  • Pandas categories are NOT translated to R factors. Instead the original data type of the category is preserved and transformed according to the rules. This is because R factors are integers and levels are always strings, in pandas factors can be any type and leves any type as well, therefore it is not always adecquate to coerce everything to the integer/character system. In the other hand, pandas category level information is lost in the process.

  • Any other object is transformed to a character using the str representation of the object.

  • Columns with mixed types are translated to character. This does not apply to column cotaining np.nan, where the missing values are correctly translated.

  • R integers are 32 bit. Therefore python 64 bit integer have to be promoted to numeric in order to fit.

  • A pandas column containing only missing values is transformed to logical, following R's behavior.

  • librdata writes Numeric missing values as NaN instead of NA. In pandas we only have np.nan both as NaN and missing value representation, and it will always be written as NaN in R.

Known limitations

  • POSIXct and POSIXlt objects in R are stored internally as UTC timestamps and may have in addition time zone information. librdata does not return time zone information and thefore the display of the tiemstamps in R and in pandas may differ.

  • Librdata reads arrays with a maximum of 3 dimensions. If more dimensions are present you will get an error. Please submit an issue if this is the case.

  • Lists are not read.

  • S4 Objects and probably other kind of objects, including those that depend on non base R packages (Bioconductor for example) cannot be read. The error code in this case is as follows:

"pyreadr.custom_errors.LibrdataError: The file contains an unrecognized object"
  • Data frames with special values like arrays, matrices and other data frames are not supported.

  • librdata first de-compresses the file in memory and then extracts the data. That means you need more free RAM than the decompress file ocuppies in memory. RData and Rds files are highly compressed: they can occupy in memory easily 40 or even more times in memory as in disk. Take it into account in case you get a "Unable to allocate memory" error (see this )

  • When writing numeric missing values are translated to NaN instead of NA.

  • Writing rownames is currently not supported.

  • Writing is supported only for a single pandas data frame to a single R data frame. Other data types are not supported. Multiple data frames for rdata files are not supported.

  • RData and Rds files produced by R are (by default) compressed. Files produced by pyreadr are not compressed by default and therefore pretty bulky in comparison. You can pass the option compress="gzip" to write_rds or write_rda in order to activate gzip compression.

  • Pyreadr writing is a relative slow operation compared to doint it in R.

  • Cannot read RData or rds files in encodings other than utf-8.

Solutions to some of these limitations have been proposed in the upstream librdata issues (points 1-4 are addressed by issue 12, point 5 by issue 16 and point 7 by issue 17). However there is no guarantee that these changes will be made and there are no timelines either. If you think it would be nice if these issues are solved, please express your support in the librdata issues.

Contributing

Contributions are welcome! Please chech the document CONTRIBUTING.md for more details.

Change Log

A log with the changes for each version can be found here

People

Otto Fajardo - author, maintainer

Jonathon Love - contributor (original cython wrapper from jamovi-readstat and msvc compatible librdata)

deenes - reading lzma compression

Daniel M. Sullivan - added license information to setup.py

pyreadr's People

Contributors

deeenes avatar dmsul avatar hexagonrecursion avatar jonathon-love avatar lewisjared avatar mateusamorim96 avatar ofajardo avatar valentynbez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyreadr's Issues

Accept remote RData file by URL

I'd like to be able to do this:

psid = pyreadr.read_r('https://github.com/jdebacker/OG-USA-Calibration/raw/master/EarningsProcesses/psid_data_files/psid1968to2015.RData')

Instead of downloading and reading separately, e.g. in a Jupyter notebook:

!wget https://github.com/jdebacker/OG-USA-Calibration/raw/master/EarningsProcesses/psid_data_files/psid1968to2015.RData
psid = pyreadr.read_r('psid1968to2015.RData')

(which works)

Thanks for the useful package.

osx ModuleNotFoundError: No module named 'pyreadr.librdata'

Hi,

installed with: conda install -c conda-forge pyreadr

I get an import error on import.

Python 3.7.5 (default, Oct 25 2019, 10:52:18) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyreadr
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/xxx/pyreadr-master/pyreadr/__init__.py", line 1, in <module>
    from .pyreadr import read_r, list_objects, write_rds, write_rdata
  File "/Users/xxx/pyreadr-master/pyreadr/pyreadr.py", line 8, in <module>
    from ._pyreadr_parser import PyreadrParser, ListObjectsParser
  File "/Users/xxx/pyreadr-master/pyreadr/_pyreadr_parser.py", line 10, in <module>
    from .librdata import Parser
ModuleNotFoundError: No module named 'pyreadr.librdata'

osx 10.10

Add license metadata to PyPI

Many large organizations have strict software policies that only allow members to use open source software that is appropriately licensed. In my organization, for example, the type of license is automatically checked using PyPI metadata. The PyPI page for pyreadr currently has no license metadata and so this automated process fails and will require manual approval each time a new or past version of pyreadr needs to be used within the organization.

Adding the type of license to pyreadr's PyPI metadata will allow more people to use the package. Attached is a screen grab comparing pyreadr's PyPI page to another package that uses the same license but has relevant metadata.

Thank you!

image

Matrix data is not being read correctly

If you add the following code to the basic_dataset.R file and then run that file:

matrix_data <- matrix(1:9, nrow = 3, dimnames = list(c("X","Y","Z"), c("A","B","C")))
saveRDS(matrix_data, "two.Rds")

and then add the following test to test_basic.py,

    def test_rds_matrix(self):
        matrix = pd.DataFrame(np.array([[*range(1, 4)], [*range(4, 7)], [*range(7, 10)]]),
                              index=['X', 'Y', 'Z'],
                              columns=['A', 'B', 'C'])

        rds_path = os.path.join(self.basic_data_folder, "two.Rds")
        self.assertTrue(os.path.exists(rds_path))
        res = pyreadr.read_r(rds_path)
        print(res[None])
        self.assertTrue(matrix.equals(res[None]))

you'll notice that the test unfortunately fails. My python/cython/C++ skills are unfortunately not totally up to the task of fixing it, but it looks like it's an issue with librdata/cython code.

When I debugged the issue, it looked like the column_names of the table object are not being filled.

Thanks!

index of pandas dataframe is lost when writing to Rds

Perhaps it's a known limitation, but I didn't find it in the README.

When writing a pd.DataFrame to .Rds, the index is lost.

Example:
In Python

>>> import pandas as pd
>>> import numpy as np
>>> import pyreadr
>>> bla = pd.DataFrame(np.arange(12).reshape(4, 3), index=list('abcd'))
>>> bla
   0   1   2
a  0   1   2
b  3   4   5
c  6   7   8
d  9  10  11
>>> pyreadr.write_rds("bla.Rds", bla)

In R:

> bla = readRDS("bla.Rds")
> bla
  0  1  2
1 0  1  2
2 3  4  5
3 6  7  8
4 9 10 11

I'm on linux 64 bit with Python 3.8.6 (Anaconda), R 4.0.3, and pyreadr 0.4.0 (installed from conda).

Expected behavior:

That the rownames of the R dataframe are the index of the pandas dataframe (i.e. 'a', 'b', 'c', 'd').

Not UTF-8 data file

Please read the README, particularly the known limitations section!

Describe the issue
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd1 in position 7: invalid continuation byte

Hi, is there a way to read file in a format different to UTF-8?

Got empty dictionary when loading an *.rda file

Describe the issue
The pyreadr.read_r returns empty dictionary

To Reproduce

Expected behavior
result is a dictionary where keys are the name of objects and the values python

Setup Information:
How did you install pyreadr?
pip install pyreadr
Platform: windows 10 64 bit
Python Version: 3.7
Python Distribution: Anaconda
Using Virtualenv or condaenv? condaenv

pip install pyreadr fails because a non explicit dependency to Cython

the issue is that the setup.py does not declare the dependency to Cython (cythonize)

Reproduce

given a Dockerfile

FROM python:3.8.1 as base

RUN apt-get update && apt-get install -y --no-install-recommends build-essential r-base
RUN pip install pyreadr
docker build .

fails with this output (condensed)

Step 3/3 : RUN pip install pyreadr
 ---> Running in c680b6188389
Collecting pyreadr
  Downloading https://files.pythonhosted.org/packages/13/c6/11c8fdc9bbd9a0ea9a1e186d7ee4bbe62280c45e01bb1d743145cf32c3b4/pyreadr-0.2.2.tar.gz (943kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tenuaf85/pyreadr/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tenuaf85/pyreadr/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-tenuaf85/pyreadr/pip-egg-info
         cwd: /tmp/pip-install-tenuaf85/pyreadr/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-tenuaf85/pyreadr/setup.py", line 12, in <module>
        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.3.1; however, version 20.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install pyreadr' returned a non-zero code: 1

Suggestion

declaring the dependency in setup.py explicit should fix the issue

setup(
    # ...
    install_requires = [
        'Cython==0.29.14',
    ],
    # ...
)

see also pypa/setuptools#1317

Can't read in data frames or atomic objects save()'d in R

Describe the issue
I tried to read in several simple data frames and atomic objects that were save()'d in R into .Rdata files, and all failed, with a "LibrdataError: Unable to read from file" error. The only .Rdata file I was able to read in was one created by your pyreadr.write_rdata function.

To Reproduce
I am running R 3.6.0, 64-bit version
and (as a very new user) Python 3.7.3

I saw your nice package and thought I would try it

  1. I followed your example code to create an .RData object:
    import pyreadr
    import pandas as pd

prepare a pandas dataframe

df = pd.DataFrame([["a",1],["b",2]], columns=["A", "B"])

let's write into RData

df_name is the name for the dataframe in R, by default dataset

pyreadr.write_rdata("test.RData", df, df_name="dataset")

  1. This all worked fine. I was also able to use the load function in R to read this in

load("test.Rdata")
dataset
A B
1 a 1
2 b 2

  1. And I then save'd this in R to a new file, loaded that in, and verified they were the same

save(dataset, file="test2.Rdata")

datasetFromPy <- dataset
datasetFromPy
A B
1 a 1
2 b 2

load("test2.Rdata") # loads dataset data frame

all.equal(dataset, datasetFromPy)
[1] TRUE

  1. I then read the test.Rdata file back into Python, and it worked fine

result = pyreadr.read_r('test.RData')
print(result.keys()) # let's check what objects we got
df1 = result['dataset'] # extract the pandas data frame for object df1
df1

odict_keys(['dataset'])

  A B
a 1.0
b 2.0
  1. However, reading the test2.RData file into Python failed. In fact, I get the same
    error for any object (data frame, atomic numeric vector, e.g.) that I save() from R:

result = pyreadr.read_r('test2.RData')


LibrdataError Traceback (most recent call last)
in
----> 1 result = pyreadr.read_r('test2.RData')
2 #print(result.keys()) # let's check what objects we got
3 #df1 = result['dataset'] # extract the pandas data frame for object df1
4 #df1

~\Anaconda3\lib\site-packages\pyreadr\pyreadr.py in read_r(path, use_objects, timezone)
38 if timezone:
39 parser.set_timezone(timezone)
---> 40 parser.parse(path)
41
42 result = OrderedDict()

~\Anaconda3\lib\site-packages\pyreadr\librdata.pyx in pyreadr.librdata.Parser.parse()

~\Anaconda3\lib\site-packages\pyreadr\librdata.pyx in pyreadr.librdata.Parser.parse()

LibrdataError: Unable to read from file

Any ideas? Thanks.

Setup Information:
How did you install pyreadr? (pip install pyreadr)
Platform (windows 10, 64 bit)
R 3.6.0, 64-bit version
Python Version 3.7.3
Python Distribution (Anaconda, using Jupyter Notebook)
Using Virtualenv or condaenv? I don't know what this means

ImportError: DLL load failed

I am unable to import pyreadr package. it throws with an error:

File "C:\work\projects\test\env\lib\site-packages\pyreadr_pyreadr_parser.py", line 10, in
from .librdata import Parser
ImportError: DLL load failed: The specified module could not be found.

ImportError: DLL load failed while importing librdata: Can't find the specified module.

Describe the issue

Trying to use this package I got the same error as #23. I followed the steps instructed in the issue at pyreadstat referred to in #23, but still can't get it to work.

I have found all DLLs and added to PATH and made sure that the system can find them using Dependencies. See the screenshot:

DependenciesGui.exe screenshot

I had to set the PATH environment variable in order to Dependencies to find them. Here's the code printing the PATH environment variable and the PYTHONPATH environment variable

PATH environment variable

PYTHONPATH environment variable

But importing pyreadr still fails

import pyreadr
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Eugenio\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pyreadr\__init__.py", line 1, in <module>
    from .pyreadr import read_r, list_objects, write_rds, write_rdata, download_file
  File "C:\Users\Eugenio\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pyreadr\pyreadr.py", line 10, in <module>
    from ._pyreadr_parser import PyreadrParser, ListObjectsParser
  File "C:\Users\Eugenio\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pyreadr\_pyreadr_parser.py", line 17, in <module>
    from .librdata import Parser
ImportError: DLL load failed while importing librdata: No se puede encontrar el mÃŗdulo especificado.

To Reproduce

  1. Install python 3.9 as a Windows app.
  2. Install pandas and pyreadr with pip (python -m pip install pandas pyreadr)
  3. Open a PowerShell terminal
  4. (Optional, doesn't really make a difference) Set PYTHONPATH $Env:PYTHONPATH = $Env:PATH to match PATH, which points to the folders with the DLLs
  5. Start a python shell
  6. Run import pyreadr

Expected behavior

Import should not fail.

Setup Information:

  • How did you install pyreadr? (pip, conda, directly from repo)
    python -m pip install pyreadr
  • Platform (windows, macOS, linux, 32 or 64 bit)
    Edition Windows 10 Pro
    Version 21H2
    Installed on ‎20/‎05/‎2021
    OS compilation 19044.1348
    Experience Windows Feature Experience Pack 120.2212.3740.0
  • Python Version
    3.9
  • Python Distribution
    Plain python from microsoft store
  • Using Virtualenv or condaenv?
    No

R File issue

Hi there, I'm trying to open the rds from this dataset. However, it says that I cannot open the file using the designated function. Can you double check if this file works on this platform? Thanks!

bzip2-compressed RData object results in "unsupported compression scheme" error

Hi,

I have a large RData file with multiple different data frames and matrices and therefore I compressed it using bzip2 when using save(..., compress="bzip2"). If I use the function load() in R, the RData file is read without problems. However, pyreadr complains with a LibrdataError that "The file is compressed using an unsupported compression scheme".

To Reproduce:
In R:

x <- tibble(id = seq(1, 100), cat = sample(c("A", "B", "C", "D"), 100, replace = T))
save(x, file = "tmp.RData", compress = "bzip2")

In Python

import pyreadr
pyreadr.read_r("tmp.RData")

Expected behavior:
From what I read in pyreadr/libs/librdata/src/rdata_read.c, reading bzip2-compressed RData object should be possible, or am I mistaken? If pyreadr cannot read compressed RData objects because the underlying librdata module doesn't allow it, it should be stated in the known limitation section.

Setup Information:
How did you install pyreadr? pip
Platform linux, 64 bit
Python Version: 3.7.3
Python Distribution Miniconda

Thanks,
Alex

Read R Date values in as datetime.date

I am trying to read in an R dataframe that I saved to an RDS file. The dataframe includes a column that is a Date type.

However, after loading the value in the RDS file into a Pandas DataFrame using pyreadr.read_r, that column is a numeric value. I suspect, but haven't tested, that the number represents the days since January 1, 1970 (based on Dates and Times in R).

It would be great if Date values in R could be automatically converted to datetime.date Python objects.

from .librdata import Parser ImportError: DLL load failed

Hye,
I'm just installing pyreadr (pip install pyreadr) from my virtualenv (created with python 3.7.6 and venv) with "pip install pyreadr" and got the above error when trying to read .Rdata.
Maybe some dependencies are missing ?
Thanks for tour attention,
Didier

Improvement request: support `~` in paths to files

Please read the README, particularly the known limitations section!

Describe the issue
For read_r, the path argument doesn't accommodate ~/path/to/file arguments.

After very cursory look through the code, seems like this might be an issue in the underlying c library; but could potentially use some python to always convert paths to absolute first, then pass on?

To Reproduce:
on ubuntu 18.08

import pyreadr
pth = "~/Downloads/test.rds"
thing = pyreadr.read_r(pth)

File example
Can make a test file with roughly: Rscript -e "saveRDS(data.frame(id=1:5), '~/Downloads/test.rds')"

Expected behavior
That a path with ~ is expanded and file is found.

Setup Information:
How did you install pyreadr? pip
Platform linux 64 bit
Python Version 3.7.5
Python Distribution system
Using Virtualenv or condaenv? no

Cannot read .rds file

I have followed the instructions - importing pyreadr, and load the file:

result = pyreadr.read_r('/path/to/file.Rds')

Then I list the keys of the 'result' object, I get

list(result.keys())
[]

Then I try

df = result[None]

It shows
Traceback (most recent call last):
File "", line 1, in
KeyError: None

How can I solve this problem? Thanks!

Aren't able to install the latest release on Windows Python 3.7

Maybe I'm missing something, but I can't seem to install this latest release on my machine. I'm running Windows 10, Python 3.7 64 bit, have all the prerequisites in place (MS Build Tools etc)... But it keeps falling into an error (output as follows):

C:\WINDOWS\system32>pip install pyreadr
Collecting pyreadr
Using cached pyreadr-0.2.8.tar.gz (978 kB)
Requirement already satisfied: pandas>0.24.0 in c:\program files\python37\lib\site-packages (from pyreadr) (1.0.3)
Requirement already satisfied: numpy>=1.13.3 in c:\program files\python37\lib\site-packages (from pandas>0.24.0->pyreadr) (1.18.3)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\program files\python37\lib\site-packages (from pandas>0.24.0->pyreadr) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\program files\python37\lib\site-packages (from pandas>0.24.0->pyreadr) (2019.3)
Requirement already satisfied: six>=1.5 in c:\program files\python37\lib\site-packages (from python-dateutil>=2.6.1->pandas>0.24.0->pyreadr) (1.14.0)
Building wheels for collected packages: pyreadr
Building wheel for pyreadr (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\setup.py'"'"'; file='"'"'C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\PrattAA\AppData\Local\Temp\pip-wheel-knh_vv83'
cwd: C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr
Complete output (170 lines):
[1/1] Cythonizing pyreadr/librdata.pyx
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pyreadr
copying pyreadr\custom_errors.py -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr\pyreadr.py -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr_pyreadr_parser.py -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr_pyreadr_writer.py -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr_init_.py -> build\lib.win-amd64-3.7\pyreadr
running egg_info
writing pyreadr.egg-info\PKG-INFO
writing dependency_links to pyreadr.egg-info\dependency_links.txt
writing requirements to pyreadr.egg-info\requires.txt
writing top-level names to pyreadr.egg-info\top_level.txt
reading manifest file 'pyreadr.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '.h'
warning: no files found matching '
.pyx'
warning: no files found matching '.pxd'
warning: no files found matching '
.c'
writing manifest file 'pyreadr.egg-info\SOURCES.txt'
copying pyreadr\librdata.c -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr\librdata.pxd -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr\librdata.pyx -> build\lib.win-amd64-3.7\pyreadr
creating build\lib.win-amd64-3.7\pyreadr\libs
creating build\lib.win-amd64-3.7\pyreadr\libs\librdata
creating build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\CKHashTable.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_bits.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_error.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_io_unistd.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_parser.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_read.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_write.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
creating build\lib.win-amd64-3.7\pyreadr\libs\bzip2
copying pyreadr\libs\bzip2\bzlib.h -> build\lib.win-amd64-3.7\pyreadr\libs\bzip2
creating build\lib.win-amd64-3.7\pyreadr\libs\iconv
copying pyreadr\libs\iconv\iconv.h -> build\lib.win-amd64-3.7\pyreadr\libs\iconv
copying pyreadr\libs\librdata\src\CKHashTable.h -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata.h -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_bits.h -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_internal.h -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_io_unistd.h -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
creating build\lib.win-amd64-3.7\pyreadr\libs\zlib
copying pyreadr\libs\zlib\zconf.h -> build\lib.win-amd64-3.7\pyreadr\libs\zlib
copying pyreadr\libs\zlib\zlib.h -> build\lib.win-amd64-3.7\pyreadr\libs\zlib
running build_ext
building 'pyreadr.librdata' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\pyreadr
creating build\temp.win-amd64-3.7\Release\pyreadr\libs
creating build\temp.win-amd64-3.7\Release\pyreadr\libs\librdata
creating build\temp.win-amd64-3.7\Release\pyreadr\libs\librdata\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ipyreadr -I. -Ipyreadr/libs/zlib -Ipyreadr/libs/bzip2 -Ipyreadr/libs/librdata -Ipyreadr/libs/iconv "-Ic:\program files\python37\include" "-Ic:\program files\python37\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcpyreadr/librdata.c /Fobuild\temp.win-amd64-3.7\Release\pyreadr/librdata.obj -DHAVE_ZLIB -DHAVE_BZIP2
librdata.c
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(50): error C2061: syntax error: identifier 'rdata_off_t'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(50): error C2059: syntax error: ';'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2143: syntax error: missing ')' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2143: syntax error: missing '{' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2146: syntax error: missing ')' before identifier 'offset'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2061: syntax error: identifier 'offset'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ';'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ','
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(72): error C2061: syntax error: identifier 'rdata_seek_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(73): error C2365: 'read': redefinition; previous definition was 'function'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_io.h(523): note: see declaration of 'read'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(77): error C2059: syntax error: '}'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(86): error C2061: syntax error: identifier 'rdata_io_t'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(87): error C2059: syntax error: '}'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(89): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(90): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(90): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(90): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(92): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(92): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(92): error C2373: 'rdata_table_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(43): note: see declaration of 'rdata_table_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(92): error C2146: syntax error: missing ';' before identifier 'table_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(92): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2373: 'rdata_column_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(41): note: see declaration of 'rdata_column_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2146: syntax error: missing ';' before identifier 'column_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2373: 'rdata_column_name_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(45): note: see declaration of 'rdata_column_name_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2146: syntax error: missing ';' before identifier 'column_name_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2373: 'rdata_text_value_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(44): note: see declaration of 'rdata_text_value_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2146: syntax error: missing ';' before identifier 'text_value_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2373: 'rdata_text_value_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(44): note: see declaration of 'rdata_text_value_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2146: syntax error: missing ';' before identifier 'value_label_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2373: 'rdata_error_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(46): note: see declaration of 'rdata_error_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2146: syntax error: missing ';' before identifier 'error_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2373: 'rdata_open_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(63): note: see declaration of 'rdata_open_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2146: syntax error: missing ';' before identifier 'open_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2373: 'rdata_close_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(64): note: see declaration of 'rdata_close_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2146: syntax error: missing ';' before identifier 'close_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2146: syntax error: missing ';' before identifier 'seek_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2373: 'rdata_read_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(66): note: see declaration of 'rdata_read_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2146: syntax error: missing ';' before identifier 'read_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2373: 'rdata_update_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(67): note: see declaration of 'rdata_update_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2146: syntax error: missing ';' before identifier 'update_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2059: syntax error: 'type'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(106): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(106): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(106): error C2059: syntax error: 'type'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(106): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2061: syntax error: identifier 'unistd_seek_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ';'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2146: syntax error: missing ')' before identifier 'offset'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2061: syntax error: identifier 'offset'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ','
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2143: syntax error: missing '{' before '*'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2059: syntax error: ')'
pyreadr/librdata.c(3149): warning C4133: '=': incompatible types - from 'int *' to 'rdata_parser_s *'
pyreadr/librdata.c(3176): warning C4013: 'rdata_set_open_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3185): warning C4013: 'rdata_set_table_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3194): warning C4013: 'rdata_set_column_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3203): warning C4013: 'rdata_set_column_name_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3212): warning C4013: 'rdata_set_text_value_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3221): warning C4013: 'rdata_set_value_label_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3248): warning C4013: 'rdata_parse' undefined; assuming extern returning int
pyreadr/librdata.c(3258): warning C4013: 'rdata_parser_free' undefined; assuming extern returning int
pyreadr/librdata.c(4875): warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe' failed with exit status 2

ERROR: Failed building wheel for pyreadr
Running setup.py clean for pyreadr
Failed to build pyreadr
Installing collected packages: pyreadr
Running setup.py install for pyreadr ... error
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\setup.py'"'"'; file='"'"'C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\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\PrattAA\AppData\Local\Temp\pip-record-9vkoc6oj\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\program files\python37\Include\pyreadr'
cwd: C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr
Complete output (170 lines):
[1/1] Cythonizing pyreadr/librdata.pyx
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pyreadr
copying pyreadr\custom_errors.py -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr\pyreadr.py -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr_pyreadr_parser.py -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr_pyreadr_writer.py -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr_init_.py -> build\lib.win-amd64-3.7\pyreadr
running egg_info
writing pyreadr.egg-info\PKG-INFO
writing dependency_links to pyreadr.egg-info\dependency_links.txt
writing requirements to pyreadr.egg-info\requires.txt
writing top-level names to pyreadr.egg-info\top_level.txt
reading manifest file 'pyreadr.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '.h'
warning: no files found matching '
.pyx'
warning: no files found matching '.pxd'
warning: no files found matching '
.c'
writing manifest file 'pyreadr.egg-info\SOURCES.txt'
copying pyreadr\librdata.c -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr\librdata.pxd -> build\lib.win-amd64-3.7\pyreadr
copying pyreadr\librdata.pyx -> build\lib.win-amd64-3.7\pyreadr
creating build\lib.win-amd64-3.7\pyreadr\libs
creating build\lib.win-amd64-3.7\pyreadr\libs\librdata
creating build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\CKHashTable.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_bits.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_error.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_io_unistd.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_parser.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_read.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_write.c -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
creating build\lib.win-amd64-3.7\pyreadr\libs\bzip2
copying pyreadr\libs\bzip2\bzlib.h -> build\lib.win-amd64-3.7\pyreadr\libs\bzip2
creating build\lib.win-amd64-3.7\pyreadr\libs\iconv
copying pyreadr\libs\iconv\iconv.h -> build\lib.win-amd64-3.7\pyreadr\libs\iconv
copying pyreadr\libs\librdata\src\CKHashTable.h -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata.h -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_bits.h -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_internal.h -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
copying pyreadr\libs\librdata\src\rdata_io_unistd.h -> build\lib.win-amd64-3.7\pyreadr\libs\librdata\src
creating build\lib.win-amd64-3.7\pyreadr\libs\zlib
copying pyreadr\libs\zlib\zconf.h -> build\lib.win-amd64-3.7\pyreadr\libs\zlib
copying pyreadr\libs\zlib\zlib.h -> build\lib.win-amd64-3.7\pyreadr\libs\zlib
running build_ext
building 'pyreadr.librdata' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\pyreadr
creating build\temp.win-amd64-3.7\Release\pyreadr\libs
creating build\temp.win-amd64-3.7\Release\pyreadr\libs\librdata
creating build\temp.win-amd64-3.7\Release\pyreadr\libs\librdata\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ipyreadr -I. -Ipyreadr/libs/zlib -Ipyreadr/libs/bzip2 -Ipyreadr/libs/librdata -Ipyreadr/libs/iconv "-Ic:\program files\python37\include" "-Ic:\program files\python37\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcpyreadr/librdata.c /Fobuild\temp.win-amd64-3.7\Release\pyreadr/librdata.obj -DHAVE_ZLIB -DHAVE_BZIP2
librdata.c
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(50): error C2061: syntax error: identifier 'rdata_off_t'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(50): error C2059: syntax error: ';'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2143: syntax error: missing ')' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2143: syntax error: missing '{' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2146: syntax error: missing ')' before identifier 'offset'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2061: syntax error: identifier 'offset'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ';'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ','
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(72): error C2061: syntax error: identifier 'rdata_seek_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(73): error C2365: 'read': redefinition; previous definition was 'function'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_io.h(523): note: see declaration of 'read'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(77): error C2059: syntax error: '}'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(86): error C2061: syntax error: identifier 'rdata_io_t'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(87): error C2059: syntax error: '}'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(89): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(90): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(90): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(90): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(92): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(92): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(92): error C2373: 'rdata_table_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(43): note: see declaration of 'rdata_table_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(92): error C2146: syntax error: missing ';' before identifier 'table_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(92): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2373: 'rdata_column_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(41): note: see declaration of 'rdata_column_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2146: syntax error: missing ';' before identifier 'column_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2373: 'rdata_column_name_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(45): note: see declaration of 'rdata_column_name_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2146: syntax error: missing ';' before identifier 'column_name_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2373: 'rdata_text_value_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(44): note: see declaration of 'rdata_text_value_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2146: syntax error: missing ';' before identifier 'text_value_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2373: 'rdata_text_value_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(44): note: see declaration of 'rdata_text_value_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2146: syntax error: missing ';' before identifier 'value_label_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2373: 'rdata_error_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(46): note: see declaration of 'rdata_error_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2146: syntax error: missing ';' before identifier 'error_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2373: 'rdata_open_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(63): note: see declaration of 'rdata_open_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2146: syntax error: missing ';' before identifier 'open_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2373: 'rdata_close_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(64): note: see declaration of 'rdata_close_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2146: syntax error: missing ';' before identifier 'close_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2146: syntax error: missing ';' before identifier 'seek_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2373: 'rdata_read_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(66): note: see declaration of 'rdata_read_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2146: syntax error: missing ';' before identifier 'read_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2373: 'rdata_update_handler': redefinition; different type modifiers
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(67): note: see declaration of 'rdata_update_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2146: syntax error: missing ';' before identifier 'update_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2059: syntax error: 'type'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(106): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(106): error C2143: syntax error: missing '{' before ''
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(106): error C2059: syntax error: 'type'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata.h(106): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2061: syntax error: identifier 'unistd_seek_handler'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ';'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2146: syntax error: missing ')' before identifier 'offset'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2061: syntax error: identifier 'offset'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ','
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ')'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2143: syntax error: missing ')' before '
'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2143: syntax error: missing '{' before '*'
C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2059: syntax error: ')'
pyreadr/librdata.c(3149): warning C4133: '=': incompatible types - from 'int *' to 'rdata_parser_s *'
pyreadr/librdata.c(3176): warning C4013: 'rdata_set_open_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3185): warning C4013: 'rdata_set_table_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3194): warning C4013: 'rdata_set_column_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3203): warning C4013: 'rdata_set_column_name_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3212): warning C4013: 'rdata_set_text_value_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3221): warning C4013: 'rdata_set_value_label_handler' undefined; assuming extern returning int
pyreadr/librdata.c(3248): warning C4013: 'rdata_parse' undefined; assuming extern returning int
pyreadr/librdata.c(3258): warning C4013: 'rdata_parser_free' undefined; assuming extern returning int
pyreadr/librdata.c(4875): warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\setup.py'"'"'; file='"'"'C:\Users\PrattAA\AppData\Local\Temp\pip-install-eecb0zne\pyreadr\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\PrattAA\AppData\Local\Temp\pip-record-9vkoc6oj\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\program files\python37\Include\pyreadr' Check the logs for full command output.

When strings inside .rds file contain invalid utf-8 characters, pyreadr can't open the file

I have an rds file that contains improperly formed strings with invalid utf-8 characters. I can read and write them from R, but pyreadr won't open the file:

import pyreadr
x=pyreadr.read_r('file.rds')
Traceback (most recent call last):
File "test.py", line 1, in
File "pyreadr.py", line 40, in read_r
parser.parse(path)
File "pyreadr\librdata.pyx", line 117, in pyreadr.librdata.Parser.parse
File "pyreadr\librdata.pyx", line 139, in pyreadr.librdata.Parser.parse
File "pyreadr\librdata.pyx", line 91, in pyreadr.librdata._handle_text_value
File "pyreadr\librdata.pyx", line 192, in pyreadr.librdata.Parser.__handle_text_value
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdc in position 11: invalid continuation byte

I guess this may be librdata's issue, but can I resolve it from outside pyreadr?

Cannot load rds file

I downloaded the data file from here
https://s3.amazonaws.com/mssm-seq-matrix/human_gsm_meta.rda

read_r() gives an error
Traceback (most recent call last):
File "", line 1, in
File "/depts/ChemInfo/p/python/lib/python3.6/site-packages/pyreadr/pyreadr.py", line 40, in read_r
parser.parse(path)
File "pyreadr/librdata.pyx", line 117, in pyreadr.librdata.Parser.parse
File "pyreadr/librdata.pyx", line 142, in pyreadr.librdata.Parser.parse
pyreadr.custom_errors.LibrdataError: Unable to convert string to the requested encoding (output buffer too small)

'Segmentation fault' error when installed from pip but not from conda-forge

Issue:
When installing pyreadr==0.3.6 from pip , pyreadr.read_r crashes the python process with a 'Segmentation fault' error.
This does not happen when installing from conda-forge


To Reproduce:
Scenario 1 - error

docker run -it --rm --name test_pyreadr --user root jupyter/pyspark-notebook:42f4c82a07ff bash
pip install pyreadr==0.3.6
python
import os
import tempfile
import requests
import pyreadr

test_file_url = "https://github.com/hadley/nycflights13/blob/master/data/airlines.rda?raw=true"
# save to disk
ff = requests.get(test_file_url)
tempdir = tempfile.TemporaryDirectory()
tmp_f_path = os.path.join(tempdir.name, 'tmpfile')
with open(tmp_f_path, 'wb') as tmp:
    tmp.write(ff.content)

result = pyreadr.read_r(tmp_f_path)
# >>> result = pyreadr.read_r(tmp_f_path)
# Segmentation fault

exit

Scenario 2 - working

docker run -it --rm --name test_pyreadr --user root jupyter/pyspark-notebook:42f4c82a07ff bash
conda install -c conda-forge pyreadr==0.3.6 -y
python
import os
import tempfile
import requests
import pyreadr

test_file_url = "https://github.com/hadley/nycflights13/blob/master/data/airlines.rda?raw=true"
# save to disk
ff = requests.get(test_file_url)
tempdir = tempfile.TemporaryDirectory()
tmp_f_path = os.path.join(tempdir.name, 'tmpfile')
with open(tmp_f_path, 'wb') as tmp:
    tmp.write(ff.content)

result = pyreadr.read_r(tmp_f_path)
print(result['airlines'])
#    carrier                         name
# 0       9E            Endeavor Air Inc.
# 1       AA       American Airlines Inc.
# 2       AS         Alaska Airlines Inc.
# 3       B6              JetBlue Airways
# 4       DL         Delta Air Lines Inc.
# 5       EV     ExpressJet Airlines Inc.
# 6       F9       Frontier Airlines Inc.
# 7       FL  AirTran Airways Corporation
# 8       HA       Hawaiian Airlines Inc.
# 9       MQ                    Envoy Air
# 10      OO        SkyWest Airlines Inc.
# 11      UA        United Air Lines Inc.
# 12      US              US Airways Inc.
# 13      VX               Virgin America
# 14      WN       Southwest Airlines Co.
# 15      YV           Mesa Airlines Inc.

exit

Setup Information:
Platform: docker image (jupyter/pyspark-notebook:42f4c82a07ff), running on Docker for Windows. The pip issue also happens with the image python:3-slim.
Python Version: 3.8.6

Can't read R dataframe object saved as rds file

Problem:
Using R.3.6.3 to generate the dataframes, i saved them as .rds format.
In Spyder (Anaconda IDE), after importing pyreadr, i tried to read the files as recommended in this post on StackOverFlow.

But it returns this error message:

LibrdataError: Invalid file, or file has unsupported features

I've researched the problem but i was unable to find the solution.

File example:
RR.zip

Setup Information:

  1. I've installed pyreadr using the following command: conda install -c conda-forge pyreadr
  2. Platform: Ubuntu 18.04 LTS
  3. Python version: Python 3.7.6
  4. Python distribution: Given above
  5. Using Virtualenv or condaenv? No

Cannot read some columns of sequential integers

The readme says there's support for integer columns, but I get an error "LibrdataError: Invalid file, or file has unsupported features" trying to read even a simple, one column data frame of sequential integers. Maybe related to #30.

To Reproduce
Create the rds file from within R...

library(tidyverse)
df <- tibble(x=1:10)
write_rds(df, 'tmp.rds', compress='gz')

Now read the file from within Python...

import pyreadr
df = pyreadr.read_r('tmp.rds')
# Traceback (most recent call last):
# File "<stdin>", line 1, in <module>
#  File "/home/poliquin/anaconda3/envs/py38/lib/python3.8/site-packages/pyreadr/pyreadr.py", line 47, in read_r
#   parser.parse(path)
#  File "pyreadr/librdata.pyx", line 117, in pyreadr.librdata.Parser.parse
#  File "pyreadr/librdata.pyx", line 142, in pyreadr.librdata.Parser.parse
# pyreadr.custom_errors.LibrdataError: Invalid file, or file has unsupported features

Now, for something very strange, create the data frame in a slightly different way...

library(tidyverse)
df <- tibble(x=as.integer(c(1,2,3,4,5,6,7,8,9,10)))
write_rds(df, 'tmp.rds', compress='gz')

and everything works fine! ...

pyreadr.read_r('tmp.rds')
OrderedDict([(None,     x
0   1
1   2
2   3
3   4
4   5
5   6
6   7
7   8
8   9
9  10)])

File example
tmp.rds.zip

Expected behavior
It should not matter how the data frame is constructed in R. Reading a column of integers should work as in my second example.

Setup Information:
How did you install pyreadr? pip
Platform: Ubuntu Linux 20.04
Python Version: 3.8
Python Distribution: Anaconda
Using Virtualenv or condaenv? Yes, conda
R Version:

platform       x86_64-pc-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          4
minor          0.1
year           2020
month          06
day            06
svn rev        78648
language       R
version.string R version 4.0.1 (2020-06-06)
nickname       See Things Now

it shows me this error LibrdataError: Unable to convert string to the requested encoding (invalid byte sequence)

I want to open below dataset in python, but it keeps showing me an error. The codes are:

  import pyreadr
  result = pyreadr.read_r(r"~/Desktop/review2020.rda")
  print(result.keys())
  df1 = result["df1"]

The error:
~/opt/anaconda3/lib/python3.8/site-packages/pyreadr/pyreadr.py in read_r(path, use_objects, timezone)
46 if not os.path.isfile(path):
47 raise PyreadrError("File {0} does not exist!".format(path))
---> 48 parser.parse(path)
49
50 result = OrderedDict()

~/opt/anaconda3/lib/python3.8/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

~/opt/anaconda3/lib/python3.8/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

LibrdataError: Unable to convert string to the requested encoding (invalid byte sequence) #

How I can fix this?

Installation error : see declaration of 'ssize_t'

I am trying to install pyreadr package in VS code flask framework. using pip install pyreadr . But it is throwing me below error:

error C2371: 'ssize_t': redefinition; different basic types
c:\python36\include\pyconfig.h(174): note: see declaration of 'ssize_t'

I have installed VS 2015 Build tools for this. I appreciate if anyone can help be to fix this issue.

Allow Python 3's pathlib.Path as an alternative to str

Describe the issue

In four places, pyreadr.py requires that paths are provided as str, and throws PyreadrError if provided with a pathlib.Path

To Reproduce

Using Python 3:

>>> from pathlib import Path
>>> import pyreadr
>>> input_file = Path("./spam.rdata")
>>> pyreadr.read_r(input_file)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "[...]/pyreadr/pyreadr.py", line 44, in read_r
    raise PyreadrError("path must be a string!")
pyreadr.custom_errors.PyreadrError: path must be a string!

Expected behavior

pathlib has been part of the standard library since 3.4, and pathlib.Path("./breakfast.rdata") should be as valid a path specification as "./breakfast.rdata" for all supported versions of Python 3.

Solutions

Given that:

  • pyreadr continues to support 2.7, which does not include pathlib
  • the path is must ultimately go as a string to librdata, which we leave alone
  • any pathlib backport would add an external dependency, which is not desired

...the main options appear to be:

  1. Expand the path handling to allow pathlib.Path specifically in addition to str
  2. path = str(path) to convert whatever is provided into a string

Either would work but follow somewhat different interface philosophies.

error: The file contains an unrecognized object

import pyreadr

result = pyreadr.read_r('infile.rds')

---------------------------------------------------------------------------
LibrdataError                             Traceback (most recent call last)
<ipython-input-46-82b33438231f> in <module>
      1 import pyreadr
      2 
----> 3 result = pyreadr.read_r('infile.rds')

/projects/sysbio/projects/rojin/anaconda3/envs/scvi/lib/python3.6/site-packages/pyreadr/pyreadr.py in read_r(path, use_objects, timezone)
     45     if not os.path.isfile(path):
     46         raise PyreadrError("File {0} does not exist!".format(path))
---> 47     parser.parse(path)
     48 
     49     result = OrderedDict()

/projects/sysbio/projects/rojin/anaconda3/envs/scvi/lib/python3.6/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

/projects/sysbio/projects/rojin/anaconda3/envs/scvi/lib/python3.6/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

LibrdataError: The file contains an unrecognized object

ValueError: Unable to seek within file

This is indeed a great work. But I got the following error while using this package.

File "test.py", line 2, in <module> result = pyreadr.read_r('exps.RData') File "/home/ashiq/anaconda3/lib/python3.6/site-packages/pyreadr/pyreadr.py", line 39, in read_r parser.parse(path) File "pyreadr/librdata.pyx", line 113, in pyreadr.librdata.Parser.parse File "pyreadr/librdata.pyx", line 138, in pyreadr.librdata.Parser.parse ValueError: Unable to seek within file

Do you have any solution to this?

Fails to export data to R

I am using the library to convert an SPSS file, and conversion fails. I am attaching the file....

test.py

import pandas as pd
import pyreadr

df = pd.read_spss('en.sav')
pyreadr.write_rdata('en.rdata', df, df_name="dataset")

Traceback (most recent call last):
File "D:\Pablo\Sociologia\Mapa Social\poblaciones\services\py\test.py", line 5, in
pyreadr.write_rdata('en.rdata', df, df_name="dataset")
File "C:\Python38\lib\site-packages\pyreadr\pyreadr.py", line 119, in write_rdata
writer.write_r(path, file_format, df, df_name, dateformat, datetimeformat)
File "C:\Python38\lib\site-packages\pyreadr_pyreadr_writer.py", line 177, in write_r
pyreadr_types, hasmissing = get_pyreadr_column_types(df)
File "C:\Python38\lib\site-packages\pyreadr_pyreadr_writer.py", line 72, in get_pyreadr_column_types
curtype = type(col[0])
File "C:\Python38\lib\site-packages\pandas\core\series.py", line 882, in getitem
return self._get_value(key)
File "C:\Python38\lib\site-packages\pandas\core\series.py", line 991, in _get_value
loc = self.index.get_loc(label)
File "C:\Python38\lib\site-packages\pandas\core\indexes\base.py", line 2891, in get_loc
raise KeyError(key) from err
KeyError: 0

en.zip

Installing pyreadr via pip is failing

Describe the issue

Pyreadr does not correctly build on my system for some reason:

(venv) C:\Users\wwai\source\python\fantasyfootball>pip install pyreadr==0.3.3
Collecting pyreadr==0.3.3
  Downloading pyreadr-0.3.3.tar.gz (1.2 MB)
     |████████████████████████████████| 1.2 MB 1.3 MB/s
Requirement already satisfied: pandas>0.24.0 in c:\users\wwai\source\python\fantasyfootball\venv\lib\site-packages (from pyreadr==0.3.3) (1.1.4)
Requirement already satisfied: pytz>=2017.2 in c:\users\wwai\source\python\fantasyfootball\venv\lib\site-packages (from pandas>0.24.0->pyreadr==0.3.3) (2020.4)
Requirement already satisfied: numpy>=1.15.4 in c:\users\wwai\source\python\fantasyfootball\venv\lib\site-packages (from pandas>0.24.0->pyreadr==0.3.3) (1.19.4)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\wwai\source\python\fantasyfootball\venv\lib\site-packages (from pandas>0.24.0->pyreadr==0.3.3) (2.8.1)
Requirement already satisfied: six>=1.5 in c:\users\wwai\source\python\fantasyfootball\venv\lib\site-packages (from python-dateutil>=2.7.3->pandas>0.24.0->pyreadr==0.3.3) (1.15.0)
Building wheels for collected packages: pyreadr
  Building wheel for pyreadr (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\wwai\source\python\fantasyfootball\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\wwai\\AppData\\Local\\Temp\\pip-install-vcixazcf\\pyreadr\\setup.py'"'"'; __file__='"'"'C:\\Users\\wwai\\AppData\\Local\\Temp\\pip-install-vcixazcf\\pyreadr\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\wwai\AppData\Local\Temp\pip-wheel-ofkdy0b8'
       cwd: C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\
  Complete output (193 lines):
  [1/1] Cythonizing pyreadr/librdata.pyx
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\pyreadr
  copying pyreadr\custom_errors.py -> build\lib.win-amd64-3.9\pyreadr
  copying pyreadr\pyreadr.py -> build\lib.win-amd64-3.9\pyreadr
  copying pyreadr\_pyreadr_parser.py -> build\lib.win-amd64-3.9\pyreadr
  copying pyreadr\_pyreadr_writer.py -> build\lib.win-amd64-3.9\pyreadr
  copying pyreadr\__init__.py -> build\lib.win-amd64-3.9\pyreadr
  running egg_info
  writing pyreadr.egg-info\PKG-INFO
  writing dependency_links to pyreadr.egg-info\dependency_links.txt
  writing requirements to pyreadr.egg-info\requires.txt
  writing top-level names to pyreadr.egg-info\top_level.txt
  reading manifest file 'pyreadr.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching '*.h'
  warning: no files found matching '*.pyx'
  warning: no files found matching '*.pxd'
  warning: no files found matching '*.c'
  writing manifest file 'pyreadr.egg-info\SOURCES.txt'
  copying pyreadr\librdata.c -> build\lib.win-amd64-3.9\pyreadr
  copying pyreadr\librdata.pxd -> build\lib.win-amd64-3.9\pyreadr
  copying pyreadr\librdata.pyx -> build\lib.win-amd64-3.9\pyreadr
  creating build\lib.win-amd64-3.9\pyreadr\libs
  creating build\lib.win-amd64-3.9\pyreadr\libs\librdata
  creating build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\CKHashTable.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\rdata_bits.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\rdata_error.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\rdata_io_unistd.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\rdata_parser.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\rdata_read.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\rdata_write.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  creating build\lib.win-amd64-3.9\pyreadr\libs\bzip2
  copying pyreadr\libs\bzip2\bzlib.h -> build\lib.win-amd64-3.9\pyreadr\libs\bzip2
  creating build\lib.win-amd64-3.9\pyreadr\libs\iconv
  copying pyreadr\libs\iconv\iconv.h -> build\lib.win-amd64-3.9\pyreadr\libs\iconv
  copying pyreadr\libs\librdata\src\CKHashTable.h -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\rdata.h -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\rdata_bits.h -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\rdata_internal.h -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  copying pyreadr\libs\librdata\src\rdata_io_unistd.h -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
  creating build\lib.win-amd64-3.9\pyreadr\libs\lzma
  copying pyreadr\libs\lzma\lzma.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma
  creating build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\base.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\bcj.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\block.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\check.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\container.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\delta.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\filter.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\hardware.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\index.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\index_hash.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\lzma12.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\stream_flags.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\version.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  copying pyreadr\libs\lzma\lzma\vli.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
  creating build\lib.win-amd64-3.9\pyreadr\libs\zlib
  copying pyreadr\libs\zlib\zconf.h -> build\lib.win-amd64-3.9\pyreadr\libs\zlib
  copying pyreadr\libs\zlib\zlib.h -> build\lib.win-amd64-3.9\pyreadr\libs\zlib
  running build_ext
  building 'pyreadr.librdata' extension
  creating build\temp.win-amd64-3.9
  creating build\temp.win-amd64-3.9\Release
  creating build\temp.win-amd64-3.9\Release\pyreadr
  creating build\temp.win-amd64-3.9\Release\pyreadr\libs
  creating build\temp.win-amd64-3.9\Release\pyreadr\libs\librdata
  creating build\temp.win-amd64-3.9\Release\pyreadr\libs\librdata\src
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ipyreadr -I. -Ipyreadr/libs/zlib -Ipyreadr/libs/bzip2 -Ipyreadr/libs/lzma -Ipyreadr/libs/librdata -Ipyreadr/libs/iconv -Ic:\users\wwai\source\python\fantasyfootball\venv\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /Tcpyreadr/librdata.c /Fobuild\temp.win-amd64-3.9\Release\pyreadr/librdata.obj -DHAVE_ZLIB -DHAVE_BZIP2 -DHAVE_LZMA
  librdata.c
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(50): error C2061: syntax error: identifier 'rdata_off_t'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(50): error C2059: syntax error: ';'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2146: syntax error: missing ')' before identifier 'offset'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2061: syntax error: identifier 'offset'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ';'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ','
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(72): error C2061: syntax error: identifier 'rdata_seek_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(73): error C2365: 'read': redefinition; previous definition was 'function'
  C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_io.h(523): note: see declaration of 'read'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(77): error C2059: syntax error: '}'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(87): error C2061: syntax error: identifier 'rdata_io_t'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(88): error C2059: syntax error: '}'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(90): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(91): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(91): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(91): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2373: 'rdata_table_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(43): note: see declaration of 'rdata_table_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2146: syntax error: missing ';' before identifier 'table_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2373: 'rdata_column_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(41): note: see declaration of 'rdata_column_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2146: syntax error: missing ';' before identifier 'column_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2373: 'rdata_column_name_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(45): note: see declaration of 'rdata_column_name_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2146: syntax error: missing ';' before identifier 'column_name_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2373: 'rdata_column_name_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(45): note: see declaration of 'rdata_column_name_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2146: syntax error: missing ';' before identifier 'row_name_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2373: 'rdata_text_value_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(44): note: see declaration of 'rdata_text_value_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2146: syntax error: missing ';' before identifier 'text_value_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2373: 'rdata_text_value_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(44): note: see declaration of 'rdata_text_value_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2146: syntax error: missing ';' before identifier 'value_label_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2373: 'rdata_error_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(46): note: see declaration of 'rdata_error_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2146: syntax error: missing ';' before identifier 'error_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2373: 'rdata_open_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(63): note: see declaration of 'rdata_open_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2146: syntax error: missing ';' before identifier 'open_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2373: 'rdata_close_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(64): note: see declaration of 'rdata_close_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2146: syntax error: missing ';' before identifier 'close_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2146: syntax error: missing ';' before identifier 'seek_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2373: 'rdata_read_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(66): note: see declaration of 'rdata_read_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2146: syntax error: missing ';' before identifier 'read_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(104): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(104): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(104): error C2373: 'rdata_update_handler': redefinition; different type modifiers
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(67): note: see declaration of 'rdata_update_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(104): error C2146: syntax error: missing ';' before identifier 'update_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(104): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(105): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(105): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(105): error C2059: syntax error: 'type'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(105): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(108): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(108): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(108): error C2059: syntax error: 'type'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(108): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2061: syntax error: identifier 'unistd_seek_handler'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ';'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2146: syntax error: missing ')' before identifier 'offset'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2061: syntax error: identifier 'offset'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ','
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ')'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2143: syntax error: missing ')' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2143: syntax error: missing '{' before '*'
  C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2059: syntax error: ')'
  pyreadr/librdata.c(3187): warning C4133: '=': incompatible types - from 'int *' to 'rdata_parser_s *'
  pyreadr/librdata.c(3214): warning C4013: 'rdata_set_open_handler' undefined; assuming extern returning int
  pyreadr/librdata.c(3223): warning C4013: 'rdata_set_table_handler' undefined; assuming extern returning int
  pyreadr/librdata.c(3232): warning C4013: 'rdata_set_column_handler' undefined; assuming extern returning int
  pyreadr/librdata.c(3241): warning C4013: 'rdata_set_column_name_handler' undefined; assuming extern returning int
  pyreadr/librdata.c(3250): warning C4013: 'rdata_set_text_value_handler' undefined; assuming extern returning int
  pyreadr/librdata.c(3259): warning C4013: 'rdata_set_value_label_handler' undefined; assuming extern returning int
  pyreadr/librdata.c(3286): warning C4013: 'rdata_parse' undefined; assuming extern returning int
  pyreadr/librdata.c(3296): warning C4013: 'rdata_parser_free' undefined; assuming extern returning int
  pyreadr/librdata.c(4949): warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  ----------------------------------------
  ERROR: Failed building wheel for pyreadr
  Running setup.py clean for pyreadr
Failed to build pyreadr
Installing collected packages: pyreadr
    Running setup.py install for pyreadr ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\wwai\source\python\fantasyfootball\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\wwai\\AppData\\Local\\Temp\\pip-install-vcixazcf\\pyreadr\\setup.py'"'"'; __file__='"'"'C:\\Users\\wwai\\AppData\\Local\\Temp\\pip-install-vcixazcf\\pyreadr\\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\wwai\AppData\Local\Temp\pip-record-z8slidn3\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\wwai\source\python\fantasyfootball\venv\include\site\python3.9\pyreadr'
         cwd: C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\
    Complete output (193 lines):
    [1/1] Cythonizing pyreadr/librdata.pyx
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\pyreadr
    copying pyreadr\custom_errors.py -> build\lib.win-amd64-3.9\pyreadr
    copying pyreadr\pyreadr.py -> build\lib.win-amd64-3.9\pyreadr
    copying pyreadr\_pyreadr_parser.py -> build\lib.win-amd64-3.9\pyreadr
    copying pyreadr\_pyreadr_writer.py -> build\lib.win-amd64-3.9\pyreadr
    copying pyreadr\__init__.py -> build\lib.win-amd64-3.9\pyreadr
    running egg_info
    writing pyreadr.egg-info\PKG-INFO
    writing dependency_links to pyreadr.egg-info\dependency_links.txt
    writing requirements to pyreadr.egg-info\requires.txt
    writing top-level names to pyreadr.egg-info\top_level.txt
    reading manifest file 'pyreadr.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no files found matching '*.h'
    warning: no files found matching '*.pyx'
    warning: no files found matching '*.pxd'
    warning: no files found matching '*.c'
    writing manifest file 'pyreadr.egg-info\SOURCES.txt'
    copying pyreadr\librdata.c -> build\lib.win-amd64-3.9\pyreadr
    copying pyreadr\librdata.pxd -> build\lib.win-amd64-3.9\pyreadr
    copying pyreadr\librdata.pyx -> build\lib.win-amd64-3.9\pyreadr
    creating build\lib.win-amd64-3.9\pyreadr\libs
    creating build\lib.win-amd64-3.9\pyreadr\libs\librdata
    creating build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\CKHashTable.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\rdata_bits.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\rdata_error.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\rdata_io_unistd.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\rdata_parser.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\rdata_read.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\rdata_write.c -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    creating build\lib.win-amd64-3.9\pyreadr\libs\bzip2
    copying pyreadr\libs\bzip2\bzlib.h -> build\lib.win-amd64-3.9\pyreadr\libs\bzip2
    creating build\lib.win-amd64-3.9\pyreadr\libs\iconv
    copying pyreadr\libs\iconv\iconv.h -> build\lib.win-amd64-3.9\pyreadr\libs\iconv
    copying pyreadr\libs\librdata\src\CKHashTable.h -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\rdata.h -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\rdata_bits.h -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\rdata_internal.h -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    copying pyreadr\libs\librdata\src\rdata_io_unistd.h -> build\lib.win-amd64-3.9\pyreadr\libs\librdata\src
    creating build\lib.win-amd64-3.9\pyreadr\libs\lzma
    copying pyreadr\libs\lzma\lzma.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma
    creating build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\base.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\bcj.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\block.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\check.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\container.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\delta.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\filter.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\hardware.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\index.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\index_hash.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\lzma12.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\stream_flags.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\version.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    copying pyreadr\libs\lzma\lzma\vli.h -> build\lib.win-amd64-3.9\pyreadr\libs\lzma\lzma
    creating build\lib.win-amd64-3.9\pyreadr\libs\zlib
    copying pyreadr\libs\zlib\zconf.h -> build\lib.win-amd64-3.9\pyreadr\libs\zlib
    copying pyreadr\libs\zlib\zlib.h -> build\lib.win-amd64-3.9\pyreadr\libs\zlib
    running build_ext
    building 'pyreadr.librdata' extension
    creating build\temp.win-amd64-3.9
    creating build\temp.win-amd64-3.9\Release
    creating build\temp.win-amd64-3.9\Release\pyreadr
    creating build\temp.win-amd64-3.9\Release\pyreadr\libs
    creating build\temp.win-amd64-3.9\Release\pyreadr\libs\librdata
    creating build\temp.win-amd64-3.9\Release\pyreadr\libs\librdata\src
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ipyreadr -I. -Ipyreadr/libs/zlib -Ipyreadr/libs/bzip2 -Ipyreadr/libs/lzma -Ipyreadr/libs/librdata -Ipyreadr/libs/iconv -Ic:\users\wwai\source\python\fantasyfootball\venv\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /Tcpyreadr/librdata.c /Fobuild\temp.win-amd64-3.9\Release\pyreadr/librdata.obj -DHAVE_ZLIB -DHAVE_BZIP2 -DHAVE_LZMA
    librdata.c
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(50): error C2061: syntax error: identifier 'rdata_off_t'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(50): error C2059: syntax error: ';'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2146: syntax error: missing ')' before identifier 'offset'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2061: syntax error: identifier 'offset'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ';'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(65): error C2059: syntax error: ','
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(72): error C2061: syntax error: identifier 'rdata_seek_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(73): error C2365: 'read': redefinition; previous definition was 'function'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_io.h(523): note: see declaration of 'read'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(77): error C2059: syntax error: '}'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(87): error C2061: syntax error: identifier 'rdata_io_t'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(88): error C2059: syntax error: '}'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(90): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(91): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(91): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(91): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2373: 'rdata_table_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(43): note: see declaration of 'rdata_table_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2146: syntax error: missing ';' before identifier 'table_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(93): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2373: 'rdata_column_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(41): note: see declaration of 'rdata_column_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2146: syntax error: missing ';' before identifier 'column_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(94): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2373: 'rdata_column_name_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(45): note: see declaration of 'rdata_column_name_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2146: syntax error: missing ';' before identifier 'column_name_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(95): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2373: 'rdata_column_name_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(45): note: see declaration of 'rdata_column_name_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2146: syntax error: missing ';' before identifier 'row_name_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(96): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2373: 'rdata_text_value_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(44): note: see declaration of 'rdata_text_value_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2146: syntax error: missing ';' before identifier 'text_value_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(97): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2373: 'rdata_text_value_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(44): note: see declaration of 'rdata_text_value_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2146: syntax error: missing ';' before identifier 'value_label_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(98): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2373: 'rdata_error_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(46): note: see declaration of 'rdata_error_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2146: syntax error: missing ';' before identifier 'error_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(99): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2373: 'rdata_open_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(63): note: see declaration of 'rdata_open_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2146: syntax error: missing ';' before identifier 'open_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(100): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2373: 'rdata_close_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(64): note: see declaration of 'rdata_close_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2146: syntax error: missing ';' before identifier 'close_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(101): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2146: syntax error: missing ';' before identifier 'seek_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(102): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2373: 'rdata_read_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(66): note: see declaration of 'rdata_read_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2146: syntax error: missing ';' before identifier 'read_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(103): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(104): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(104): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(104): error C2373: 'rdata_update_handler': redefinition; different type modifiers
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(67): note: see declaration of 'rdata_update_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(104): error C2146: syntax error: missing ';' before identifier 'update_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(104): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(105): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(105): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(105): error C2059: syntax error: 'type'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(105): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(108): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(108): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(108): error C2059: syntax error: 'type'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata.h(108): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2061: syntax error: identifier 'unistd_seek_handler'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ';'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2146: syntax error: missing ')' before identifier 'offset'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2061: syntax error: identifier 'offset'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ','
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(8): error C2059: syntax error: ')'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2143: syntax error: missing ')' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2143: syntax error: missing '{' before '*'
    C:\Users\wwai\AppData\Local\Temp\pip-install-vcixazcf\pyreadr\pyreadr\libs/librdata/src/rdata_io_unistd.h(11): error C2059: syntax error: ')'
    pyreadr/librdata.c(3187): warning C4133: '=': incompatible types - from 'int *' to 'rdata_parser_s *'
    pyreadr/librdata.c(3214): warning C4013: 'rdata_set_open_handler' undefined; assuming extern returning int
    pyreadr/librdata.c(3223): warning C4013: 'rdata_set_table_handler' undefined; assuming extern returning int
    pyreadr/librdata.c(3232): warning C4013: 'rdata_set_column_handler' undefined; assuming extern returning int
    pyreadr/librdata.c(3241): warning C4013: 'rdata_set_column_name_handler' undefined; assuming extern returning int
    pyreadr/librdata.c(3250): warning C4013: 'rdata_set_text_value_handler' undefined; assuming extern returning int
    pyreadr/librdata.c(3259): warning C4013: 'rdata_set_value_label_handler' undefined; assuming extern returning int
    pyreadr/librdata.c(3286): warning C4013: 'rdata_parse' undefined; assuming extern returning int
    pyreadr/librdata.c(3296): warning C4013: 'rdata_parser_free' undefined; assuming extern returning int
    pyreadr/librdata.c(4949): warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\wwai\source\python\fantasyfootball\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\wwai\\AppData\\Local\\Temp\\pip-install-vcixazcf\\pyreadr\\setup.py'"'"'; __file__='"'"'C:\\Users\\wwai\\AppData\\Local\\Temp\\pip-install-vcixazcf\\pyreadr\\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\wwai\AppData\Local\Temp\pip-record-z8slidn3\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\wwai\source\python\fantasyfootball\venv\include\site\python3.9\pyreadr' Check the logs for full command output.

To Reproduce
pip install pyreadr

File example
N/A

Expected behavior
installing the package from the wheel

Setup Information:
How did you install pyreadr? pip
Platform Windows 10 64 bit
Python Version 3.9
Python Distribution plain python
Using Virtualenv or condaenv? Venv

I try to read a rds file, but get the following error:

This is my code:

import pyreadr
result = pyreadr.read_r('data/injuryTimeDataset.rds')

This is the error:
parser.parse(path)
File "pyreadr\librdata.pyx", line 117, in pyreadr.librdata.Parser.parse
File "pyreadr\librdata.pyx", line 139, in pyreadr.librdata.Parser.parse
File "pyreadr\librdata.pyx", line 102, in pyreadr.librdata._handle_value_label
File "pyreadr\librdata.pyx", line 197, in pyreadr.librdata.Parser.__handle_value_label
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 1: invalid start byte

What should I do? I have not looked in the rds file, but it is supposed to be a mixture of strings, ints and floats. Lastly, this works:
pyreadr.object_list

Unable to allocate memory

Hi,

I am trying to open an RData file with pyreadr. I receive a librdata error for memory allocation. The file opens to 23.1gb in R. I have 64gb of memory (about 55gb free showing in top when I try to import the data in Python).

Here is the traceback

---------------------------------------------------------------------------
LibrdataError                             Traceback (most recent call last)
<ipython-input-4-580e0186f0c1> in <module>
----> 1 result = pyreadr.read_r(path)

~/.local/lib/python3.8/site-packages/pyreadr/pyreadr.py in read_r(path, use_objects, timezone)
     46     if not os.path.isfile(path):
     47         raise PyreadrError("File {0} does not exist!".format(path))
---> 48     parser.parse(path)
     49 
     50     result = OrderedDict()

~/.local/lib/python3.8/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

~/.local/lib/python3.8/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

LibrdataError: Unable to allocate memory

Pyreadr is install from git using pip install git+https://github.com/ofajardo/pyreadr.git.

I pulled the latest bz, lzma, and other dependencies from aptitude on Jan 27, 2020.

Thanks

Unable to read from file (seurat objects)

operation in Rīŧš

if (!require('Seurat')) install.packages('Seurat')
if (!require('dplyr')) install.packages('dplyr')

if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("SingleCellExperiment")
library(SingleCellExperiment)

epi <- readRDS("./scRNA-seq/epi.tsne.rds")
fib <- readRDS("./scRNA-seq/fib.tsne.rds")
imm <- readRDS("./scRNA-seq/imm.tsne.rds")

#convert the Seurat object to a SingleCellExperiment object
epi.sce <- as.SingleCellExperiment(epi)
fib.sce <- as.SingleCellExperiment(fib)
imm.sce <- as.SingleCellExperiment(imm)
#epi.sce ... is an AnnData object now

#save Rdata
save(epi.sce,fib.sce,imm.sce,file = "seurat.Rdata")

operation in jupyter notebook (python3.6):

import pyreadr
seurat = pyreadr.read_r("seurat.Rdata")
print(seurat.keys())

it has an error:

LibrdataError Traceback (most recent call last)
in
1 import pyreadr
----> 2 seurat = pyreadr.read_r("seurat.Rdata")

/opt/conda/lib/python3.6/site-packages/pyreadr/pyreadr.py in read_r(path, use_objects, timezone)
45 if not os.path.isfile(path):
46 raise PyreadrError("File {0} does not exist!".format(path))
---> 47 parser.parse(path)
48
49 result = OrderedDict()

/opt/conda/lib/python3.6/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

/opt/conda/lib/python3.6/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

LibrdataError: Unable to read from file

Why don't you compress files?

I investigated a few, and I believe that creating compressed rdata files in no more that calling:

import sys
import gzip
import shutil

with open('uncompressedfile.rdata', 'rb') as f_in:
with gzip.open('compressedfile.gz.rdata', 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)

I was wondering why your library wouldn't do that while saving... Is any other format issue I am not aware of?

Thanks a lot, Pablo.

Jupiter notebook kernel dies every time use pyreadr.read_r

Describe the issue
A clear and concise description of what the issue is.

To Reproduce
pyreadr.read_r('file')

Setup Information:
How did you install pyreadr?

pip

Platform ( linux)

Python Version
3.8.2
Python Distribution ( Anaconda)

It could relate to the file being not sparse matrixes when loading a sparse matrix data from R.

Support File-like objects instead of just path strings

I would love to be able to pass a python File object (with read interfaces etc) rather than just a file on disk: I sometimes have these files in RAM and can't currently read them. It seems to me that this would be a pretty simple fix here but is there something I'm missing?

Error attempting to read .RData

I've been happily using pyreadr.read_r for several months, but suddenly encountered an issue. I'm generating R data frames (data.frame) and writing files with save(). read_r( exits with the error message "LibrdataError: Invalid file, or file has unsupported features". After spending a day trying to understand why, I'm hoping you can enlighten me, but I don't know how to send you the file.
Thanks for helping,
John

Bug while exporting a dataframe with a unique value and categories

I am loading a simple 1 column, few values dataframe from a sav file. In has categorical values.

If those values are: 1,1,1,2, it works ok.
If those values are: 1,1,1,1 it fails.

To Reproduce
Run test.py attached.

Error is: Categorical cannot perform the operation all.

Wild guess: maybe someone in the chain is returning an Int when there only one value, instead of an array.

Error: (<class 'TypeError'>, TypeError('Categorical cannot perform the operation all'), <traceback object at 0x000001CCD528E9C0>)
Traceback (most recent call last):
File "D:\Pablo\Sociologia\Mapa Social\poblaciones\services\py\spss2r3.py", line 29, in main
pyreadr.write_rdata(sys.argv[2] + '.tmp', df, df_name="dataset")
File "C:\Python38\lib\site-packages\pyreadr\pyreadr.py", line 119, in write_rdata
writer.write_r(path, file_format, df, df_name, dateformat, datetimeformat, compress)
File "C:\Python38\lib\site-packages\pyreadr_pyreadr_writer.py", line 207, in write_r
pyreadr_types, hasmissing = get_pyreadr_column_types(df)
File "C:\Python38\lib\site-packages\pyreadr_pyreadr_writer.py", line 89, in get_pyreadr_column_types
if not np.all(equal):
File "<array_function internals>", line 5, in all
File "C:\Python38\lib\site-packages\numpy\core\fromnumeric.py", line 2411, in all
return _wrapreduction(a, np.logical_and, 'all', axis, None, out, keepdims=keepdims)
File "C:\Python38\lib\site-packages\numpy\core\fromnumeric.py", line 85, in _wrapreduction
return reduction(axis=axis, out=out, **passkwargs)
File "C:\Python38\lib\site-packages\pandas\core\generic.py", line 11571, in logical_func
return self._reduce(
File "C:\Python38\lib\site-packages\pandas\core\series.py", line 4227, in _reduce
return delegate._reduce(name, skipna=skipna, **kwds)
File "C:\Python38\lib\site-packages\pandas\core\arrays\categorical.py", line 2082, in _reduce
raise TypeError(f"Categorical cannot perform the operation {name}")
TypeError: Categorical cannot perform the operation all

test.zip

Unable to read .RData - LibrdataError: Invalid file, or file has unsupported features

Hi,

I have started using the library to read files here: https://github.com/HerrMo/multi-omics_benchmark_study/tree/master/data/resample-instances

with the following script from your github:

import pyreadr
result = pyreadr.read_r('BLCA_rin.RData') # also works for Rds
print(result.keys())

But I got this error:

---------------------------------------------------------------------------
LibrdataError                             Traceback (most recent call last)
<ipython-input-2-e10bae565a8a> in <module>
      1 import pyreadr
----> 2 result = pyreadr.read_r('BLCA_rin.RData') # also works for Rds
      3 print(result.keys())

~/anaconda3/envs/saraenv/lib/python3.9/site-packages/pyreadr/pyreadr.py in read_r(path, use_objects, timezone)
     46     if not os.path.isfile(path):
     47         raise PyreadrError("File {0} does not exist!".format(path))
---> 48     parser.parse(path)
     49 
     50     result = OrderedDict()

~/anaconda3/envs/saraenv/lib/python3.9/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

~/anaconda3/envs/saraenv/lib/python3.9/site-packages/pyreadr/librdata.pyx in pyreadr.librdata.Parser.parse()

LibrdataError: Invalid file, or file has unsupported features

Any help to solve that?

ValueError: Unable to allocate memory

Hello @ofajardo,
This is a great package!

My RDS files are 300MB+ and I run into memory issues

import pyreadr
scr = 'xyz.rds'
result = pyreadr.read_r(scr)
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\tsaeger\AppData\Local\Continuum\anaconda3\lib\site-packages\pyreadr\pyreadr.py", line 39, in read_r
parser.parse(path)
File "pyreadr\librdata.pyx", line 113, in pyreadr.librdata.Parser.parse
File "pyreadr\librdata.pyx", line 138, in pyreadr.librdata.Parser.parse
ValueError: Unable to allocate memory

It works like a champ for smaller RDS files. I have not tested where the cut-off is. My system has 32GB of RAM.

Best,
--T

Compilation on Windows 32 bit not working

Windows compilation fails for 32 bit:

windows: build\temp.win32-3.8\Release\pyreadr\libs\librdata\src\rdata_write.o:rdata_write.c:(.text+0x67a): undefined reference to `_mkgmtime32'

For now, raise an exception in setup.py if trying to compile for 32 bit, so that people using pip don't get the above exception but a nice message saying, please use 64 bit

segmentation fault when reading RData file

Thanks for developping this tool.

I have a segmentation fault as reported in #56 with version 0.3.9.

Downgrading to 0.3.7 fixes the issue. This may be a regression bug that I bring to your attention.

I installed the two versions with pip under Linux fedora python 3.7.3 (conda environment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.