dodger487 / dplython

dplyr for python
MIT License
763 stars 52 forks source link

dplython cannot be imported into Python v3.6.2? #89

Closed sharpe5 closed 7 years ago

sharpe5 commented 7 years ago

I attempted to import dplython:

import pandas from dplython import (DplyFrame, X, diamonds, select, sift, sample_n, sample_frac, head, arrange, mutate, group_by, summarize, DelayFunction)

This error was displayed:

Traceback (most recent call last): File "C:\Users\Shane\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2862, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in from dplython import (DplyFrame, X, diamonds, select, sift, sample_n, File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = sel am Files\JetBrains\PyCharm Community Edition 2017.2\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self.sy ok.py", line 21, in do o_import module = self._system_import(name, *args, **kwargs) ModuleNotFoundError: No module named 'dplython'

The dplython module appears to be installed, as I can see it in the list of packages in PyCharm. However, I cannot see it in the list of packages in Anaconda, which seems suspicious.

To install, I checking out the git repository, then used:

python setup.py install

Result:

E:\git\dplython>python setup.py install running install running bdist_egg running egg_info writing dplython.egg-info\PKG-INFO writing dependency_links to dplython.egg-info\dependency_links.txt writing requirements to dplython.egg-info\requires.txt writing top-level names to dplython.egg-info\top_level.txt reading manifest file 'dplython.egg-info\SOURCES.txt' writing manifest file 'dplython.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib warning: install_lib: 'build\lib' does not exist -- no Python modules to install creating build\bdist.win-amd64\egg creating build\bdist.win-amd64\egg\EGG-INFO copying dplython.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO copying dplython.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO copying dplython.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO copying dplython.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO copying dplython.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO zip_safe flag not set; analyzing archive contents... creating 'dist\dplython-0.0.7-py3.6.egg' and adding 'build\bdist.win-amd64\egg' to it removing 'build\bdist.win-amd64\egg' (and everything under it) Processing dplython-0.0.7-py3.6.egg Removing c:\users\shane\anaconda3\lib\site-packages\dplython-0.0.7-py3.6.egg Copying dplython-0.0.7-py3.6.egg to c:\users\shane\anaconda3\lib\site-packages dplython 0.0.7 is already the active version in easy-install.pth Installed c:\users\shane\anaconda3\lib\site-packages\dplython-0.0.7-py3.6.egg Processing dependencies for dplython==0.0.7 Searching for six==1.10.0 Best match: six 1.10.0 Adding six 1.10.0 to easy-install.pth file Using c:\users\shane\anaconda3\lib\site-packages Searching for pandas==0.20.3 Best match: pandas 0.20.3 Adding pandas 0.20.3 to easy-install.pth file Using c:\users\shane\anaconda3\lib\site-packages Searching for numpy==1.12.1 Best match: numpy 1.12.1 Adding numpy 1.12.1 to easy-install.pth file Using c:\users\shane\anaconda3\lib\site-packages Searching for pytz==2017.2 Best match: pytz 2017.2 Adding pytz 2017.2 to easy-install.pth file Using c:\users\shane\anaconda3\lib\site-packages Searching for python-dateutil==2.6.1 Best match: python-dateutil 2.6.1 Adding python-dateutil 2.6.1 to easy-install.pth file Using c:\users\shane\anaconda3\lib\site-packages Finished processing dependencies for dplython==0.0.7 E:\git\dplython>

dodger487 commented 7 years ago

Hello,

Thanks for opening an issue. I want to find and fix this issue, but in the meantime, are you able to try using pip?

Just now, I created a new virtualenv with python version 3.6. I was able to install and run examples of dplython using pip.

I'll look into what's going on with installing using setup.py install

Note that I may be a little slow to fix issues at the moment as I'm finishing up a PhD and trying to find a job!

Thanks, Chris

dwivedianuj60 commented 7 years ago

I have installed dplython using pip in anaconda (spyder v 3.6). however, when i try to run a simple "select" function I get the following error.

Without Piping

select(trans_data, X.Date)

Traceback (most recent call last):

File "", line 1, in select(trans_data, X.Date)

File "C:\Users\anuj_dwivedi\AppData\Local\Continuum\Anaconda3\lib\site-packages\dplython\dplython.py", line 132, in DplyrFcn return data_arg >> fcn_to_apply

TypeError: unsupported operand type(s) for >>: 'DataFrame' and 'function'

############ with pipinng ######################

trans_data >> select(X.Date) Traceback (most recent call last):

File "", line 1, in trans_data >> select(X.Date)

TypeError: unsupported operand type(s) for >>: 'DataFrame' and 'function'

dodger487 commented 7 years ago

@dwivedianuj60 It looks like that is a separate issue. I believe in your case trans_data is a pandas DataFrame. You need to cast trans_data to a DplyFrame before you can use the dplython syntax on it. You can do this simply through: trans_data = DplyFrame(trans_data)

sharpe5 commented 7 years ago

I tried the install using "pip", and everything is working perfectly.

I'm closing off this issue.

Thanks for the excellent work on this!