Git Product home page Git Product logo

Comments (11)

jwijffels avatar jwijffels commented on May 31, 2024

The error message says No module named pattern.db. It means it can not find the pattern package.
Please add Python to the PATH before you ran devtools::install_github("bnosac/pattern.nlp", args = "--no-multiarch") and make sure you install the pattern package correctly meaning it ends up in the Python modules folder.

from pattern.nlp.

valentinap avatar valentinap commented on May 31, 2024

Thanks for your quick reply.

If I well understand, I need to move the Python folder to the pattern.db folder, correct?

Unfortunately I'm an analyst and not a developer, so this is not really clear for me. Thanks in advance for your help

from pattern.nlp.

jwijffels avatar jwijffels commented on May 31, 2024

You need to put Python in your PATH. Have you done this? What does Sys.getenv("PATH") give you? Is the location of Python in there?

from pattern.nlp.

valentinap avatar valentinap commented on May 31, 2024

This is the PATH result:

/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

but I've got it with the command : $; echo $PATH

from pattern.nlp.

jwijffels avatar jwijffels commented on May 31, 2024

This means that Python version 3.4 is the first in the search path. The following R code will probably give you the location of Python version 3.4?

library(findpython)
find_python_cmd()

The installation instructions at
https://github.com/bnosac/pattern.nlp indicate that this will only work for python 2.5+
Change your PATH accordingly to make sure it finds Python version 2.5+ instead of version 3.4. Ask that to your local admin or set the PYTHON environment variable or do something like this


options(python_cmd = "/Library/Frameworks/Python.framework/Versions/2.7/bin/python")
devtools::install_github("bnosac/pattern.nlp", args = "--no-multiarch")

from pattern.nlp.

valentinap avatar valentinap commented on May 31, 2024

Thanks a lot for your support. I've followed your instructions installing findpython and running the command

options(python_cmd = "/Library/Frameworks/Python.framework/Versions/2.7/bin/python")

now the error is:

Skipping install of 'pattern.nlp' from a github remote, the SHA1 (0802212) has not changed since last install.
Use force = TRUE to force installation


I've also tried to change the PATH from the terminal with the following command:

sudo -s 'echo "/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin" >> /Library/Frameworks/Python.framework/Versions/2.7/bin/Python'

but the output is always (no matter which folder I try to set)

No such file or directory


I've tried to remove and install Python again, I've tried to remove SPSS that has a Python module inside, and I've tried to reinstall Sierra on the computer again. Nothing seems to solve the problem. I have two computers and the problem is the same in both machines.

Do you have any other suggest? Thanks a lot

from pattern.nlp.

jwijffels avatar jwijffels commented on May 31, 2024

You haven't given the output of

library(findpython)
find_python_cmd()

Neither provided information on your computer - is it Linux/Mac or are you in Windows on another shell?

The first thing you got "Skipping install of 'pattern.nlp' from a github remote, the SHA1 (0802212) has not changed since last install. Use force = TRUE to force installation" is that apparently you already installed pattern.nlp, the output of devtools::install_github indicates that you need to use the following for your case

options(python_cmd = "/Library/Frameworks/Python.framework/Versions/2.7/bin/python")
devtools::install_github("bnosac/pattern.nlp", args = "--no-multiarch", force = TRUE)

Please look online on how to set the PATH and how to set an environment variable called PYTHON to your non-standard location where you installed python ("/Library/Frameworks/Python.framework/Versions/2.7/bin/python"). The sudo command just isn't setting the PATH. You can just google on that.

from pattern.nlp.

valentinap avatar valentinap commented on May 31, 2024

find_python_cmd()
[1] "/Library/Frameworks/Python.framework/Versions/2.7/bin/python"

My computer is a Mac with Sierra on

I've looked dozen of results on google about changing the PATH, and tried a lot of ways. I'll find more and I'll post a question on stackoverflow, maybe I will find a solution

I would love to add your package on my course about text mining and my book, but it's really complicated to install

from pattern.nlp.

jwijffels avatar jwijffels commented on May 31, 2024

Did you install the pattern Python package as indicated in the README
as such, is it in /Library/Frameworks/Python.framework/Versions/2.7/Lib/site-packages ?

from pattern.nlp.

valentinap avatar valentinap commented on May 31, 2024

From the begin the steps I followed:

  1. Removed all Python versions

  2. Installed Python 2.7 again

  3. Downloaded pattern 2.6 folder from this link http://www.clips.ua.ac.be/pages/pattern

  4. put the pattern 2.6 folder to this folder

    /Library/Frameworks/Python.framework/Versions/2.7/lib/site-packages

  5. from the terminal, I had run

cd pattern-2.6
python setup.py install

  1. then went to R, required findpython and set the directory with the following code

options(python_cmd = "/Library/Frameworks/Python.framework/Versions/2.7/bin/python")

then installed pattern.nlp with

devtools::install_github("bnosac/pattern.nlp", args = "--no-multiarch", force = TRUE)

The output is:

Traceback (most recent call last):

File "", line 1, in

ImportError
:
No module named pattern.db
Error : .onAttach failed in attachNamespace() for 'pattern.nlp', details:
call: PythonInR::pyExec("from pattern.db import *")
error: An error has occured while executing Python code. See traceback above.
Error: loading failed
Execution halted
ERROR: loading failed

  • removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/pattern.nlp’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/pattern.nlp’
    Error: Command failed (1)

I've also tried to move the folder to Versions/2.7/bin, but nothing changes.

from pattern.nlp.

jwijffels avatar jwijffels commented on May 31, 2024

pattern.nlp uses the following code to try to find the Python pattern package which should be installed at your computer. As long as this fails, you can not install pattern.nlp

library(findpython)
can_find_python_cmd(required_modules = "pattern.db")

What you can do is look at the help of ?can_find_python_cmd or look at the source code of edit(find_python_cmd) or edit(can_find_python_cmd) to see what this function does and set the environment variables which are used there to match your specific system and non-standard location where you put Python and the Pattern package.

from pattern.nlp.

Related Issues (13)

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.