Installing activity-browser - progressbar error - brightway

I am trying to install the activity-browser for brightway2 on Mac OS X. In the terminal and in my b2-python directoy, I write:
bin/pip install https://bitbucket.org/cmutel/activity-browser/get/2.0.zip
The installation starts nicely with downloading and checking the required packages. For progessbar-ipython however, I get an error an the installation stops:
File "/private/var/folders/7h/4zl3jkyd4dzgc464d3ljvv7h0000gn/T/pip-build-m1_3y3zc/progressbar-ipython/progressbar/__init__.py", line 49, in <module>
from compat import *
ImportError: No module named 'compat'
I have learned that the error comes from support for python 2.4 only, as described here: https://github.com/niltonvolpato/python-progressbar/issues/28 , and here: https://bbs.archlinux.org/viewtopic.php?id=209444
Unfortunately, I don't get it installed. Admitted, I am not very familiar with manually installing packages. Attempts with replacing the cached version with a corrected one as described in the links have failed so far.
Do you have any ideas and suggestions? Thanks a lot!
Best wishes, Niklas

It looks like you haven't activated the right environment. I assume you have followed the installation instructions. If so, you need to make sure to activate with brightway2 environment with something like source ~/bw2-python/bin/activate bw2.
progessbar-ipython hasn't been a dependency for a long time. I guess the development versions of bw2-* should be official releases instead of devX, as this is just causing problems.

Related

Error--rescode.err_missing_license_file(1008): License cannot be located

I was running a python program which uses CVXPY to solve a optimization problem involving semi-definite constraints. Initially the code ran well when I was using the default solver provided by CVXPY. Then I tried to use MOSEK as the optimization solver. Since it has to be installed, I tried installing it from command prompt using a pip installer. However the installation was interrupted midway (I am unaware of the specific reasons). Now whenever I am trying to run the code, it is prompting an error-
rescode.err_missing_license_file(1008): License cannot be located. The default search path is ';C:\Users\dsouv\mosek\mosek.lic;'.
I can understand that somehow the default search path has been changed due to the failed installation of MOSEK. Even after calling the default solver of CVXPY, I am still getting the same error.
Things I have tried:
Reinstalling CVXPY.
Reinstalling MOSEK from the Anaconda Powershell Prompt.
Even after trying out these, the error still persist. Any suggestions to solve this issue is welcome. Also please me if you need any other informtion.
Thanks
You should install the license file separately. I.e. do step 3 at
https://www.mosek.com/resources/getting-started/

import win32api in python 3.7 resulting in dll import error

I am having the error while running jupyter notebook. Error replication:
python --version
Python 3.7.9
python
import win32api
The error was: ImportError: DLL load failed
After doing a some stackoverflow, I got to know that there are 2 dll files missing namely: pythoncom37.dll and pywintypes37.dll
I also got to know that I can run this post command: pywin32_postinstall.py in the Scripts folder. I ran this script. Restarted my pc. I manually download these two dll and copied it to my system32. After manually downloading, I started to have a different type of error: ImportError: DLL load failed: %1 is not a valid Win32 application
I used anaconda and ran my jupyter notebook which was my main aim but can you please make me aware as what is going wrong?
I've run into this recently, but with a different version of the DLLs. What solved it for me was using a different version of pywin32.
My solution (conda env, python 3.8.5):
pip install pywin32==300
or try 225, 227, 228. The latest pywin32 (301 as of this post) seems to be having dll search issues (I wouldn't be surprised if whatever version you were using is also having dll search issues). 301 was released after your issue started, but you may have a similar problem nonetheless.
There is currently an issue on pywin32 DLL loading failing: https://github.com/mhammond/pywin32/issues/1709
Factors involved (in my experience) include your PATH variable (if you're using conda). I haven't tested it myself, but I'd be curious to see if this issue occurs without conda. This issue stops happening for me if the first dlls found are those for 301. In my case, that means putting them in my C:\Windows\System32 folder (yeah I'm on Windows; joy).
So a possible solution #2 would be to run the pywin32 post install script which should be located under your venv/Scripts/pywin32_postinstall.py
To try that solution, open an ADMIN command prompt (very important that it's admin), navigate to your venv, and run:
ppython.exe Scripts\pywin32_postinstall.py --install
You shouldn't HAVE to do this, but if you just need a one-off solution and it works, great!
pip install --upgrade pywin32 ==225 worked for me. Tried version 300 and was unsuccessful.

Pygame/Python/Terminal/Mac related

I'm a beginner, I have really hit a brick wall, and would greatly appreciate any advice someone more advanced can offer.
I have been having a number of extremely frustrating issues the past few days, which I have been round and round google trying to solve, tried all sorts of things to no avail.
Problem 1)
I can't import pygame in Idle with the error:
ModuleNotFoundError: No module named 'pygame' - even though it is definitely installed, as in terminal, if I ask pip3 to install pygame it says:
Requirement already satisfied: pygame in /usr/local/lib/python3.7/site-packages (1.9.4)
I think there may be a problem with several conflicting versions of python on my computer, as when i type sys.path in Idle (which by the way displays Python 3.7.2 ) the following are listed:
'/Users/myname/Documents', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Users/myname/Library/Python/3.7/lib/python/site-packages', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages'
So am I right in thinking pygame is in the python3.7/sitepackages version, and this is why idle won't import it? I don't know I'm just trying to make sense of this. I have absoloutely no clue how to solve this,"re-set the path" or whatever. I don't even know how to find all of these versions of python as only one appears in my applications folder, the rest are elsewhere?
Problem 2)
Apparently there should be a python 2.7 system version installed on every mac system which is vital to the running of python regardless of the developing environment you use. Yet all of my versions of python seem to be in the library/downloaded versions. Does this mean my system version of python is gone? I have put the computer in recovery mode today and done a reinstall of the macOS mojave system today, so shouldn't any possible lost version of python 2.7 be back on the system now?
Problem 3)
When I go to terminal, frequently every command I type is 'not found'.
I have sometimes found a temporary solution is typing:
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
but the problems always return!
As I say I also did a system reinstall today but that has helped none!
Can anybody please help me with these queries? I am really at the end of my tether and quite lost, forgive my programming ignorance please. Many thanks.
Try it with the problem1
I'm not an expert neither, but I think you need to install both in terminal and python in order to use the program.
python -m pip install pygame
You should actually add the export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" to your .bash_profile (if you are using bash). Do this by opening your terminal, verifying that it says "bash" at the top. If it doesn't, you may have a .zprofile instead. Type ls -al and it will list all the invisible files. If you have .bash_profile listed, use that one. If you have .zprofile, use that.
Type nano .bash_profile to open and edit the profile and add the command to the end of it. This will permanently add the path to your profile after you restart the terminal.
Use ^X to exit nano and type Y to save your changes. Then you can check that it works when you try to run the program from IDLE.

ModuleNotFoundError when installing packages

I've been having a problem with installing packages in PyCharm. This started happening a few months ago, but before that it was fine. I can install it from the cmd using pip, but when I try to import it into the IDE it gives this error:
ModuleNotFoundError: No module named '_winreg'
and isn't available for use. The package I'm trying to install right now is pygame, but it has had trouble with other ones. I tried to make sure I have winreg installed by using 'pip3 install winreg' in the cmd, but it gives error text saying, "Could not find a version that satisfies the requirement winreg." What am I doing wrong?
Also, if it helps, I'm using Windows and the latest version of PyCharm, as well as python 3. Thanks for the help, I've been looking for a while now.
I think one of your problems possibly is that you didn't add pygame in your project interpreter. (To add it go to File -> Settings -> Project Interpreter then click the green plus sign and search for pygame.) I don't know if this will work for winreg, but tell me if it does.
I can't find _winreg anywhere, I've searched winreg's file, and modules , there don't seems like any of _winreg. I think you probably want to import winreg, not _winreg.
And also, if you are using PyCharm's venv, you need to use the project's prompt to import,or project interpreter.
Could not find a version that satisfies the requirement sometime means your python's version is too new for the module to use.

Install pybrain on python 3.2

I'm trying to install pybrain on python 3.2. It says here: https://github.com/pybrain/pybrain/pull/85 that it should work. However it does not for me.
I tried:
$export PYTHONPATH=$PYTHONPATH:'/home/luis/Documents/pybrain/'https://github.com/pybrain/pybrain/pull/85
which works well for python 2.7.
Did somebody get it to work?
After hours of "what the hell?!"s I installed it.
First the installer suggested is not updated for Python3 so I installed Distribute. With that installed I was able to use python setup.py install in the directory where I unrared pybrain. It gave a ton of errors. So I found this article (god bless google translate) and used 2to3 on pybrain directory. After I tried to install it again it gave an error on from string import split so I edited the file and removed that line (it is not needed really) and tried yet another time. This time no errors occurred and I was able to import pybrain without any problems. The same problem with the from string import split occurs in utilities.py again, so edit that line too.
I used 2to3 to turn examples to python3 too. benchmarkplots.py seems to work.
Update:
pybrain now supports python3
Here's how to install if you run into trouble
pip install https://github.com/pybrain/pybrain/archive/0.3.3.zip
Or just grab latest github pybrain release.

Resources