Locking Failed! with pipenv lock --clear - python

So everything was working correctly until I tried to install the "requests" library for flask. In my virtual environment I ran "pipenv install requests" and got this fun error message:
File "/mnt/c/Users/Mtayl/OneDrive/Desktop/aA-work/FridgeFinder/FridgeFinder/fridgefinder/backend/.venv/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 100, in __init__
raise InvalidRequirement(
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'-lembic'": Expected W:(abcd...)
I have looked all over the interwebs and cannot find anything that leads to a solution. The best I have been able to find is that somewhere, in a file, there exists '-lembic' where I am assuming it should be either ~lembic or alembic. I have tried using "pipenv lock --clear" but I get the same message. I have even tried switching git branches to get around this but to no avail. Any help would be seriously appreciated.
If the full trace is needed I will post it, but that seems to be where the trace ends.

Related

Creating or Using a VENV File/ Portability

Venv File I have a project that utilizes YoloV5, OpenCV, as well as many other python libraries. After finally finishing work on the project, I wanted to share it with my teammates. However, I was unable to get my code to run anywhere other than my machine. There was a Venv file that was generated automatically somewhere along the way, either by my IDE or a jupyter notebook. I tried giving out this file to others, but it is not only massive (~1GB), but it also didn't work. I will consistently get syntax errors that do not exist in my environment. For example, I will get:
"SyntaxError: Non-ASCII character '\xf0' in file detect.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
"
If I remove that line, I get:
" File "detect.py", line 120
model.warmup(imgsz=(1 if pt else bs, 3, *imgsz)) # warmup
^
SyntaxError: invalid syntax
"
Mind you, none of these errors exist in my environment.
I have tried looking up various commands to somehow link the venv file to the environment or to the python file. I thought that, perhaps, python wasn't looking for the file, so it wasn't using it. I also tried installing other packages and installing all the dependencies manually. However, none of these things worked. I am a little lost on where to go from here, I have heard of tools like Conda, which apparently might help manage things like this, but I am wondering if anyone could give advice on how to proceed, or maybe if anyone else has personally used YoloV5 and encountered this problem themselves

AttributeError: dlsym(RTLD_DEFAULT, run): symbol not found - meaning

I am attempting to use the PyMultinest package. The full error text I am encountering is AttributeError:dlsym(RTLD_DEFAULT, run): symbol not found in the __getitem__() function in ctypes/__init__.py. I'll include more text and code below, but I am mostly trying to understand what this error is telling me - my Google Fu is apparently lacking, and the StackExchange questions I have seen relating to this error seem to be hyper-focused on solving a specific instance of this error. So - What is this error trying to tell me is wrong?
More context. I attempt to execute the PyMultinest (PMN) package as directed in the PMN documentation. PMN is, effectively, a Python wrapper for a C program. Running PMN requires a fair bit of setup code (several ancillary functions need to be defined, as well as a host of variables), which I'm not including here by default because it's ... a lot, but I can if needed. The PMN execution line I use is
pmn.run(Loglike, Prior, ndims, n_live_points=1000, n_params=n_params, outputfiles_basename='./'+ProjectName+'/temp_', resume=False, verbose=True)
This returns the error traceback
File "[redacted]", line 139, in <module>
pmn.run(Loglike, Prior, ndims, n_live_points=1000, n_params=n_params, outputfiles_basename='./'+ProjectName+'/temp_', resume=False, verbose=True)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymultinest/run.py", line 254, in run
lib.run(*args_converted)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__
func = self.__getitem__(name)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 386, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, run): symbol not found
If it helps, I have determined that the name variable being passeed through self.__getitem__(), and thus into self._FuncPtr(), is run. Although, that might be obvious looking at the AttributeError message.
I am running Python 3.8 (as shown above) on a MacOS machine. Last summer, I was able to execute PMN on this machine using extremely similar code to that which I am using now. I am currently trying to optimize my code from last summer, which is why I'm surprised it isn't simply "working".
So far my attempts at fixing this have been mostly centered on reinstalling PMN. I have done a clean install (pip uninstall/pip install) of the PMN package, as well as following the PMN documentation to rebuild the C portion of the package. I have included the source directories of the C software in my Path variables - or at least, I tried to, I am assuming I was successful, but I'm not very familiar with Macs.
Ultimately, I just wish I understood what Python was telling me with this error better. It would help me direct my own attempts at solving the issue. I suspect it is saying "We don't know where to find this 'run' command you're asking for," in which case I need to figure out why my Path variable changes aren't working. Am I on the right path?
Some hints how to resolve this are given in these issues:
https://github.com/JohannesBuchner/PyMultiNest/issues/160
https://github.com/JohannesBuchner/PyMultiNest/issues/163
It is important to cleanly recompile (empty build folder) when the environment changes, so that cmake recognises changed libraries and compilers.
Check if you are running everything with python3 and not python (works as python 2.x is you have both version 2 and 3 installed)
Check is all the PyMultiNest python files are rewritten in python 3 style, e.g. $ print "something" becomes $ print("something")
My supervisor was accidentally running on python 2.7 and got the same error, so your error might as well be due to mismatch of python version usages.
Run command flutter pub cache clean and flutter clean and after that run flutter pub get now relaunch your emulator it worked for me.

Error initializing ctypes in pybuilder

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

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

Cannot find PRAW config file when wrapping application with py2app

I'm trying to wrap my Python script into an application using py2app, but when I try to run the app I'm getting this PRAW related error:
Exception: Could not find config file in any of: ['/Users/username/CS/Applicationame/dist/applicationname.app/Contents/Resources/lib/python2.7/site-packages.zip/praw/praw.ini', '/Users/username/.config/praw.ini', 'praw.ini']
The strange thing is I navigated to the first path, unzipped site-packages.zip and found praw.ini inside /praw, so I'm not really sure why I'm getting this error. I've also tried using pyinstaller but I get the same error.
I came across this error today - not in the context of py2app, but after a pip upgrade of praw. In case you still have this problem (unlikely :)) and/or in the interest of posterity, here's how I was able to fix it: I noticed that the error was in reading the praw.ini file, which very much exists on my system. The real problem was the owner of the file was root, and the owner only had read privileges. Changing that to have my account read/execute privileges to everything inside praw fixed the issue.

Categories