Forum Archive

Regex and numpy question

puckypuck

Hello,

When i trying import data i get this error.

import regex as re
E ModuleNotFoundError: No module named 'regex’

And another error when i try to import pandas

ImportError: this version of pandas is incompatible with numpy < 1.13.3
E your numpy version is 1.8.0.
E Please upgrade numpy to >= 1.13.3 to use this pandas version

I cant find where i can update the numpyversion.

Hope someone can help me.

JonB

You can't update regex or numpy. You can't install pandas.

Go to your site-packages folder and delete regex and pandas and whatever else you installed that uses c code. Then force quit pythonista and import numpy and regex again to verify whether there are other broken modules.

pulbrich

Try

import re

You cannot upgrade numpy, the available version is part of the Pythonista app, not user upgradable.

puckypuck

@pulbrich
Import re doesnt work, same error

pulbrich

If I run

import re

print(re)

I get

<module 're' from '/var/containers/Bundle/Application/7F183C05-845F-47C3-93D3-533E30766BBB/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/re.py'>

which is what it should be. Could you try these two lines of code and show the console output?

puckypuck

@pulbrich

I get the same
module 're' from '/var/containers/Bundle/Application/

pulbrich

Then you can use re, which is the Pythonista supplied regex module.

puckypuck

@pulbrich

Ok thanks for the support.
I dont know what i do wrong, trying running the script and get error all the time

pavlinb

I have Pythonista v3.2 , iPhone v13.3.1,
re works perfect.

JonB

@puckypuck can you post the full traceback of the problem you get, along with the code?

If you have tried to install pandas, and numpy, etc, you need to go clean out your site packages folder.

In your original code you wrote

import regex as re

Which is not correct -- you just want import re

puckypuck

@JonB

Ok i cleaned my side packages.

============================= test session starts ==============================
platform ios -- Python 3.6.1, pytest-3.0.5, py-1.4.32, pluggy-0.4.0 -- /private/var/containers/Bundle/Application/79823AB3-8B78-4BFE-85AA-07A6911F8A59/Pythonista3.app/Pythonista3
rootdir: /private/var/mobile/Containers/Shared/AppGroup/09B9F2A0-A8A6-48F9-A9FF-5270C93BC17E/Pythonista3/Documents, inifile:
collecting ... collected 0 items / 1 errors

generated xml file: /private/var/mobile/Containers/Shared/AppGroup/09B9F2A0-A8A6-48F9-A9FF-5270C93BC17E/Pythonista3/Documents/.pythonista_pytest_log.xml
==================================== ERRORS ====================================
____ ERROR collecting test2.py ____
ImportError while importing test module '/private/var/mobile/Containers/Shared/AppGroup/09B9F2A0-A8A6-48F9-A9FF-5270C93BC17E/Pythonista3/Documents/test2.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test2.py:5: in
from binance.client import Client
site-packages-3/binance/client.py:8: in
from .helpers import date
to_milliseconds, interval_to_milliseconds
site-packages-3/binance/helpers.py:3: in
import dateparser
site-packages-3/dateparser/
init__.py:4: in
from .date import DateDataParser
site-packages-3/dateparser/date.py:10: in
import regex as re
E ModuleNotFoundError: No module named 'regex'
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.96 seconds ============================

And here is my code:
import matplotlib
from matplotlib import pyplot as plt

from binance.client import Client
import keys

Client = Client(apikey,apisecret)

klines_df =pd.Dataframe (Client.get_historical_klines("BTCUSDT",Client.KLINE_INTERVAL_1DAY,"1000 days ago UTC"))

print(klines_df)

JonB

Looks like binance has non pure dependencies.

autobahn==18.7.1
certifi==2019.11.28
cryptography==2.3
dateparser==0.7.0
pyOpenSSL==19.0.0
requests==2.22.0
service-identity==17.0.0
Twisted==19.7.0

Cryptography is a no.
Pyopenssl depends on it, though there may be a way to force it to use crypto instead.

Requests, you may be able to update, though it can be tricky.

Try reinstalling pip install regex. Then try import regex, and make sure that works. regex is pure py, so should work. For quit pythonista and try again.

puckypuck

This regex is killing me.
I have reinstalled pythonista, again the message no module regex.
tryed pip install regex and get a setup.py error message

Sorry for the many questions, and this is the last time before i give up.

[~/Documents]$ pip install regex
Querying PyPI ...
Downloading package ...
Opening: https://files.pythonhosted.org/packages/73/d9/b58289d885180b5d538aa6df07974b5fe6088547ac846c0f76f77259c304/regex-2020.1.8.tar.gz

Save as: /private/var/mobile/Containers/Data/Application/E4F4BB3B-DCD1-4E68-9C70-3BE1281A906D/tmp//regex-2020.1.8.tar.gz (681106 bytes)
681106 [100.00%]
Extracting archive file ...
Archive extracted.
Running setup file ...
WARNING: Extension modules are skipped: [<main.OmniClass object at 0x1155afb38>]
PipError('cannot locate source folder/file: /private/var/mobile/Containers/Data/Application/E4F4BB3B-DCD1-4E68-9C70-3BE1281A906D/tmp/2cc8cbdf6ff94fec933154320700e076/regex-2020.1.8/regex.py',)
Failed to run setup.py
Fall back to directory guessing ...
Error: Cannot locate packages. Manual installation required.
[~/Documents]$

JonB

Ok, scratch that... I was looking at a different regex on GitHub ... The regex package is
https://bitbucket.org/mrabarnett/mrab-regex/

And is c code -- thus not supported.

A quick skim seems to show that dateparser/regex should work in pypy, and so maybe pythonista, but maybe you need to manually download the package, and just copy into site-packages.