Giter VIP home page Giter VIP logo

Comments (24)

klahnakoski avatar klahnakoski commented on May 22, 2024

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

from activedata.

maggienj avatar maggienj commented on May 22, 2024
  1. Yes, this (pip install -r requirements (using pip from the 2.7 version)) was run before executing the "Tests" step. Here are the results of that cmd.
    http://elasticsearchpy.blogspot.com/2017/03/pip-install-r-requirementstxt-results.html

  2. Will try this pip install pyparsing and then report back.

Fyi:
Python version is 2.7.5
http://elasticsearchpy.blogspot.com/2017/03/python-2.html

Thanks,

from activedata.

maggienj avatar maggienj commented on May 22, 2024

Tried running pip install pyparsing...
Here is the output..

[mocha@osboxes ActiveData]$ pip install pyparsing
Requirement already satisfied (use --upgrade to upgrade): pyparsing in /usr/lib/python2.7/site-packages
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[mocha@osboxes ActiveData]$

from activedata.

maggienj avatar maggienj commented on May 22, 2024

Ran it again
test_sort (unittest.loader.ModuleImportFailure) ... ERROR
test_deep_ops (unittest.loader.ModuleImportFailure) ... ERROR

Full results are captured here.
http://elasticsearchpy.blogspot.com/2017/03/ran-tests-section-once-again-and-got.html

from activedata.

maggienj avatar maggienj commented on May 22, 2024

Could this be due to the "__init__.py" in the root of the folder?
Not sure...
Here is a stackoverflow thread related to module import err.
http://stackoverflow.com/questions/23854677/django-finds-tests-but-fail-to-import-them

and this one..
http://stackoverflow.com/questions/37591726/django-test-unittest-loader-moduleimportfailure

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

no, I am wrong. It is this part

export PYTHONPATH=/usr/bin/python

You have python in the path, but have not included the ActiveData directory

export PYTHONPATH=/usr/bin/python;.

I always forget if ";" or "," are path separators, so I hope you know what I mean

...even that path might be wrong, based on your configuration

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

...and what does python --version give?

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

Do you have multiple python versions? If so, be sure to use the pip for your version of Python

 python -m pip install pyparsing

..or even better, call the version of Python you want to use explicitly:

 /usr/bin/python -m pip install pyparsing

from activedata.

maggienj avatar maggienj commented on May 22, 2024

(1) - Fyi: By the way, that is __init__.py documenting this in git(here) auto removed the __ .
(2) - yupe ... got it regarding the export PYTHONPATH it is a colon :
export PYTHONPATH=/usr/bin/python:.
(3) - it appears pyparsing is already installed and the results are shown below.

[mocha@osboxes ~]$  /usr/bin/python -m pip install pyparsing
Requirement already satisfied: pyparsing in /usr/lib/python2.7/site-packages
[mocha@osboxes ~]$
[mocha@osboxes ~]$
[mocha@osboxes ~]$ python --version
Python 2.7.5
[mocha@osboxes ActiveData]$ export PYTHONPATH=/usr/bin/python:.
[mocha@osboxes ActiveData]$
[mocha@osboxes ActiveData]$
[mocha@osboxes ActiveData]$ python active_data/app.py --settings=resources/config/simple_settings.json
Traceback (most recent call last):
  File "active_data/app.py", line 27, in <module>
    from active_data.actions.json import get_raw_json
  File "/home/mocha/ActiveData/active_data/actions/json.py", line 17, in <module>
    from active_data.actions.query import _send_error
  File "/home/mocha/ActiveData/active_data/actions/query.py", line 16, in <module>
    import moz_sql_parser
  File "/usr/lib/python2.7/site-packages/moz_sql_parser/__init__.py", line 16, in <module>
    from moz_sql_parser.sql_parser import SQLParser
  File "/usr/lib/python2.7/site-packages/moz_sql_parser/sql_parser.py", line 16, in <module>
    from pyparsing import \
ImportError: cannot import name infixNotation
[mocha@osboxes ActiveData]$

In order to not to conflict with any other versions of VM, have created a brand new VM for this purpose.
So, this contains only one version of Python which is 2.7.5

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

This brings back my memories of getting python to run on my machine the first time: Oh the pain.

I was assuming that you put the /usr/bin/python for a reason. Let's not use it:

export PYTHONPATH=.

of course, this assumes the current directory is ActiveData

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

The next thing is to verify the python path includes the path to the pyparsing:

sudo find / -name pyparsing.py

To verify where the pyparsing is, and

import os
import sys

print(os.environ['PYTHONPATH'])
print(sys.path)

to see what the paths are

from activedata.

maggienj avatar maggienj commented on May 22, 2024

yes, the current dir is ActiveData while running export export PYTHONPATH=.

[mocha@osboxes ~]$ cd ~/Active*
[mocha@osboxes ActiveData]$
[mocha@osboxes ActiveData]$ export PYTHONPATH=.
[mocha@osboxes ActiveData]$ sudo find / -name pyparsing.py
/usr/lib/python2.7/site-packages/pip/_vendor/pyparsing.py
/usr/lib/python2.7/site-packages/pyparsing.py
[mocha@osboxes ActiveData]$
[mocha@osboxes ActiveData]$ python
Python 2.7.5 (default, Nov  6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os;
>>> import sys;
>>> print(os.environ['PYTHONPATH']);
.
>>> print(sys.path);
['', '/home/mocha/ActiveData', '/usr/lib64/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/gtk-2.0', '/usr/lib/python2.7/site-packages']
>>>

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

Let's see if python can simply import the required modules:

from moz_sql_parser.sql_parser import SQLParser
from pyparsing import infixNotation

I wonder why there are two site-packages in your path:

/usr/lib64/python2.7/site-packages
/usr/lib/python2.7/site-packages

which makes me suspect there are two different Python versions on your machine. To be sure we run the correct one:

/usr/bin/python -m pip install -r requirements.txt
/usr/bin/python active_data/app.py --settings=resources/config/simple_settings.json

...plus

/usr/bin/python --version

from activedata.

maggienj avatar maggienj commented on May 22, 2024
[mocha@osboxes ActiveData]$ python
Python 2.7.5 (default, Nov  6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from moz_sql_parser.sql_parser import SQLParser;
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/moz_sql_parser/__init__.py", line 16, in <module>
    from moz_sql_parser.sql_parser import SQLParser
  File "/usr/lib/python2.7/site-packages/moz_sql_parser/sql_parser.py", line 16, in <module>
    from pyparsing import \
ImportError: cannot import name infixNotation
>>> from pyparsing import infixNotation;
>>> from pyparsing import infixNotation;
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name infixNotation
>>>

The reason for two diff lib... lib and lib64 for site-packages.... is possibly due to the fact that CentOS operating system comes built in with Python 2.7

/usr/lib64/python2.7/site-packages
/usr/lib/python2.7/site-packages

Python Version

[mocha@osboxes ActiveData]$ /usr/bin/python --version
Python 2.7.5

How many different pythons? Only one...

[mocha@osboxes ActiveData]$ which python
/usr/bin/python

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

Good!

>>> from pyparsing import infixNotation;
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name infixNotation

This makes me hopeful because we have a single line of Python code to test out problem with!

Thinking....

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

how about which python27 ?

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

I reviewed my scripts for installing on AWS instances (a centos derivative)

sudo yum -y install python27
sudo easy_install pip
sudo pip install --upgrade pip
sudo /usr/bin/python27 -m pip install -r requirements.txt
/usr/bin/python27 active_data/app.py --settings=resources/config/simple_settings.json

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

ping me on irc, for faster interaction

from activedata.

maggienj avatar maggienj commented on May 22, 2024

Elastic Search and Python setup is complete in Windows 10.
Screenshots are shown here in this repo ... along with few steps just in case if anyone else tries to install the same in Windows.

https://github.com/maggienj/ActiveDataElasticSearchPyStp/blob/master/README.md

from activedata.

aditi25 avatar aditi25 commented on May 22, 2024

Hi, Sorry to bug here. I need to contribute to the project as part of outreachy. Please direct me to the right platform for same. Possibly an IRC nick which serves my purpose.

from activedata.

klahnakoski avatar klahnakoski commented on May 22, 2024

The main page for this session of Outreachy: https://wiki.gnome.org/Outreachy/2017/MayAugust

The outreachy channel is IRC #outreachy at irc.gnome.org:6667, which has a number of people that can point you to projects.

I am ekyle on irc.mozilla.org

from activedata.

maggienj avatar maggienj commented on May 22, 2024

The setup runs fine in Windows 10 with Python 2.7.12 and Elastic Search 1.7.1
All the steps and the unit test results are shown here..
https://github.com/maggienj/ActiveDataElasticSearchPyStp/blob/master/unit_test_results.txt

readme which shows the steps for the same are here..
https://github.com/maggienj/ActiveDataElasticSearchPyStp/blob/master/README.md

Upgraded Elastic Search to v5.2.2 to test how ActiveData functions in the upgraded version.
The last part of readme.md shows the snapshots of Elastic Search v5.2.2 service

This issue can now be closed as the steps mentioned in Readme.md works fine for Python 2.7.12 and Elastic Search 1.7.1 and the unit tests ran successfully. Test results link are attached above.

A new issue is opened for the upgraded version of Elastic Search 5.2.2

from activedata.

Related Issues (20)

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.