Error initializing ctypes in pybuilder - python

A couple of days ago I cloned a git repository and tried to make a build out of that code with PyBuilder; however, I have not been able to do so.
Every time I run pyb -X -E jenkins-zipfile-release in Bash I get the following error: BUILD FAILED - Error initializing ctypes. The thing is, none of my colleagues have this problem, we don't know why.
The traceback tells me the problem is here: .../pyenv/versions/2.7.14/lib/python2.7/site-packages/oscrypto/_openssl/_libcrypto_ctypes.py
We thought the problem that my python was not correctly compiled with SSL. We even had a different SSL version. I replaced LibreSSL with OpenSSL, but the problem persists.
Another person told me that maybe the oscrypto libraries are conflicting (one from the environment and the other one from the project's lib directory) How can I check that?
I would deeply appreciate if someone could point me in the right direction, I've been trying for two days now.

There was an issue with regards to running oscrypto in a High Sierra. The issue was fixed and it will be a part of the next release.
More info: https://github.com/wbond/oscrypto/issues/22

Related

Unable to import modules in pycharm in spite being installed in the used python interpreter

Even after installing dash - getting module import error.
Pycharm does not throw any compilation errors on the line as well.
How could this be resolved?
I tried everything as suggested in comments and stuff known to me but could not resolve this - have done this a thousand times earlier but don't know what went wrong this time.
The only solution the=at worked was to create a new project, copy files over manually and then create a fresh interpreter and VE.

Invalid Salt on Local versus Heroku (Encoding UTF-8 problems)

The Issue:
It appears there is some sort of encoding/decoding issue going on with flask-bcrypt for my Mac. I'd like to know if there is an easy solution to fix this so I can run my local with a similar setup to my Heroku version.
Comparison:
Local
If I use .decode("utf-8") with generate_password_hash it returns AttributeError: 'str' object has no attribute 'decode'. Without decode, it saves my password to the database properly and I'm able to login with no issues.
When I test bcrypt.generate_password_hash [without decode] in terminal on local it
returns like '$2b$12$yTBsCi.....`
Heroku
If I use .decode("utf-8") with generate_password_hash it saves to the database properly and I"m able to login. If I don't use decode("utf-8"), it saves the password incorrectly (something like: \x243261243132245a4e64696e4d7062327......) and when I try to login it returns ValueError: Invalid salt.
When I test bcrypt.generate_password_hash [without decode] on heroku bash it returns
b'$2b$12$amVQ6f2.d......'
Current Setup:
Both are running Python 3.6.4. Both Heroku and my local version have identical requirements installed. bcrypt==3.1.4 Flask-bcrypt==0.7.1 py-bcrypt==0.4
Documentation:
https://flask-bcrypt.readthedocs.io/en/latest/
In Python 3, you need to use decode(‘utf-8’) on generate_password_hash(), like below:
pw_hash = bcrypt.generate_password_hash(‘hunter2’).decode(‘utf-8’)
Final Thoughts:
Any solutions to get my Mac encoding/decoding correctly? Perhaps because MacOS relies on Python 2.7 it's messing it up? But this shouldn't be the case within my virtualenv.....
I've run echo $LANG and looked at the psql server_encoding on local/heroku and they are both identical for utf8.
So! This is a mind boggling problem for a lot of people. Now that I have found a solution, I'm back to post the results.
Solution Part A: [The most important piece is in Solution Part B, this is a minor fix]. The first thing I realized was that I was using double quotes around my utf-8. I then rechecked the documentation and realized it was a single quote .decode('utf-8'). As soon as I did this, it seemed to fix the problem (at least temporarily). Why that fixes it, I'm uncertain, but that's something to try and a small detail to overlook. After a few days of more pushes, the bug popped back up.
Solution Part B: This is the much larger problem that I learned. After hours of searching I stumbled on a google search that was something along the lines of "Flask-bcrypt py-bcrypt conflict". There were some ambiguous stack overflow questions and github issues that lead me to realize there was likely something conflicting between these packages. So naturally I removed them an reinstalled py-bcrypt, flask-bcrypt, and bcrypt. Same problem. Then I did it again in a different order....new problem....about ffi being missing. So then I uninstalled all of them and ONLY installed flask-bcrypt. Well wouldn't you know...that fixed the problem for Heroku and my local. It turns out that when you install flask-bcrypt it auto installs bcrypt. I left py-bcrypt uninstalled entirely. It seems bcrypt and py-crypt really don't like each other.
Hope that fixes it for you!
(note: I do have this feeling that bcrypt is still accessing py-bcrypt in some way, maybe through headers or the python package itself. Regardless, removing it from my virtual environment did the trick).
(alternative solution: I heard if these packages just really don't play nice, you can use generate_password_hash from something like werkzeug or try installing the cryptography package. I didn't want to go that route though, but worth a shot).

Cstdint Missing Error When Installing Pydaedalus with PiP

I am working on an application which involves route finding (a completely different subject), but for testing I need example mazes to test on. A colleague suggested I use pydaedalus to generate large scale mazes in the format I need. I am using the following code to try and install the module:
$pip3.6 install pydaedalus
This returns the following error:
-Wno-error=format-security
In file included from daedalus/_maze.cpp:467:
In file included from daedalus/wrapper.h:8:
daedalus/src/util.h:31:10: fatal error: 'cstdint' file not found
#include <cstdint>
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
I have done some research and have found nothing which addresses this. I have also done some (limited) C++ development using cstdint, which has always worked.
I came across this question, but it appears to address a separate issue.
I am developing in OSX 10.10.5
Any help that you can provide is much appreciated!
These compile errors are down to daedalus's requirement of the C++11 standard, which is sometimes a bit tricky to get working on Mac OS X. One idea might be to check to make sure your Xcode is completely up to date.
The page you linked also suggests to try linking against clang's standard library instead of the GCC standard library. I'm not sure if this will work, or if it will give you linking errors on build or when you import daedalus into python, but you could give it a shot anyway:
CFLAGS='-stdlib=libc++' pip3.6 install pydaedalus
Another idea would be to encourage pip to use the clang++ frontend, which your link also suggests might help. You should be able to set this with the environment variable CXX (or, just possibly, CC).
CXX=clang++ pip3.6 install pydaedalus
Try various combinations of those environment settings (e.g., CXX and CFLAGS), and hopefully something will work eventually.

Fixing broken django module that was installed from pip, where is the code?

I have been trying to use the django-visits module, though I seem to not even get this to run cause the minute I follow the instructions for just adding it to my application here:
https://bitbucket.org/jespino/django-visits/src/c3ac83b91969?at=default
It gives me an error when I try to run server:
ERRORS:
visits.Visit.ip_address: (fields.E900) IPAddressField has been removed
except for support in historical migrations.
HINT: Use GenericIPAddressField instead.
Their hint was helpful enough, but I have no idea where pip instaleld my django-visits to where I can change the model code of this module to fix the IPAdressField
Am I approaching solving this error wrong? Should I not be looking for the original code that was installed somewhere on my machine? Do I need to somehow install this from source and not use Pip since I have to change the models.py in this module?
(I am trying to make this work on my OS X machine but ultimately will need to get this to work on CentOS box). Also the database is postgres/postgis

Mercurial installation issue

We've installed mercurial 1.4.1 and python 2.6.2 on a solaris 8 box. Now some hg commands work as expected, others fail.
I was able to initialize a repository (hg init) and add a file (hg add) but the committing (hg commit) leads to an error message:
abort: could not import module found!
I need a hint where to look - I'm not a python expert, is this missing found module part of the python distribution or does it belong to mercurial? Any idea how to fix it?
Edit
Thanks for your comments - hg debuginstall runs fine, just reports one problem - I didn't set a username in any of the config files. Can't believe that this causes the actual problems...
Edit
--traceback was a good hint!!
Here's the last line (can't copy&paste):
ImportError: ld.so.1: hg: fatal: relocation error:
file:/usr/local/lib/python2.6/lib-dynload/zlib.so:
symbol inflateCopy: referenced symbol not found
The zlib.so library is present was installed with either the python or mercurial package.
Looks like I'm not the only one: here's the same problem with python 2.5 on solaris 10
You need to install the zlib library for your system (libz.so).
Check your LD_LIBRARY_PATH settings.
If it is pulling libz from an odd place you will need to fix it so that it is pulling from /pkg/local/lib first
I was seeing this:
ldd /pkg/local/lib/python2.7/lib-dynload/zlib.so
libz.so => /import/wgs/lib/libz.so
But now its working for me.

Categories