I failed when I tried to run the new release .I follow the document and run the example script with python example.py , but I receive the response.
Traceback (most recent call last):
File "example.py", line 114, in <module>
main(add_a_camera=False, enable_autopilot=True)
File "example.py", line 43, in main
client = carla.Client('localhost', 2000)
AttributeError: 'module' object has no attribute 'Client'
Could you please tell me how to solve it ? Thank you !
Did you find the solution for this? I have the same problem.
Ok, solved it.
You probably have anaconda installed on your system, so when you run 'python example.py' it uses the Anaconda environment python and not the one that is native to your system.
So, you will have to edit ~/.bashrc and comment the path to anaconda python
If you are using the compiled version of Carla, then all will work fine.
If you built Carla from the source, then there are additional steps to do.
You will have to first run 'make PythonAPI', this will generate a .egg file in PythonAPI/dist/, now go into the example.py and edit the path to the .egg file accordingly
Now, the script should run fine on the source version too.
@StarryFire hello,thank you for your help.I didn't install anaconda,and I change the path to the .egg file as you say,but it didn't work.The result just as the same as before.
@StarryFire thanks for the solution. I can run the 'make PythonAPI', and it claims that it has successfully installed Carla lib in "C:/carla/PythonAPIdist", but the dist folder actually doesnt exist because I'm getting this error right before the last line:
'libboost_python37-vc141-mt-x64-1.67.lib
Have you built it on a Windows machine or Linux ?
@goksanisil23 I have built this on Linux. You will have to read their docs on their website if you are having trouble installing it on Windows. They also mention they don't recommend using 0.9.0 on windows as the docs are out-of-date.
@meixialin That's weird. Are you sure that the code is indeed able to find the .egg file?
sys.path.append(
'dist/carla-0.9.0-py%d.%d-linux-x86_64.egg' % (sys.version_info.major,sys.version_info.minor))
do check that the sys.version_info.major and sys.version_info.minor give out the required values.
@goksanisil23 It seems that your Python version is 32 bits, make sure you are using the 64 bits one. Sorry for the delay, we have been on vacations.
@StarryFire I was getting the same error while running python example.py (Ubuntu).
So as you suggested I tried make PythonAPI, but I am getting the below output.
kk@kk-Lenovo-ideapad-320-15ISK:~/Carla/CARLA_0.9.0$ make PythonAPI
make: Nothing to be done for 'PythonAPI'.
Could you please let me know if there are any additional steps required here?
Thank you,
KK
i suggest you first delete the directory "carla\Build\boost-install" , then "make clean" , and then "make launch" , and then "make PythonAPI". Maybe this will correct your problem
I am trying to make PythonAPI from the main carla folder but it raises these build errors. how can i fix them?
Check that py is available in you system. Open and command line and type py, it should open the default python version.
I just encountered this issue, the cause might be I installed PythonClient from pre-compiled version 0.8.4
using this:
"pip2 install -e . --user --upgrade"
https://github.com/carla-simulator/carla/tree/master/carla_ros_bridge
After uninstall it "pip uninstall carla"
now my
"python example.py" cmd won't find the incorrect version of carla.
And when I dol
python -c 'import carla; print carla'
it's pointing to somewhere
~/carla/pre-/CARLA_0.8.4/PythonClient/__init__.pyc
which is the wrong version.
Removing both of them (or one of them) fixed the issue.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I SOLVED IT ...
JUST INSTALL PYTHON 3.7 VERSION 64 BIT ONLY NOT 32 BIT IF YOUR COMPUTER IS 64 BIT
this was cause of all error and install all packages "py -m pip install pkg_name" in requirement.txt of all place. requirement.txt will be at 2 places check it and one download is enough 2.9 gb dont go for other download.
Thanks gauravkumar22927, I was trying to run it with python 3.8 64-bit, but is has to be 3.7 64-bit as you said.
Most helpful comment
I just encountered this issue, the cause might be I installed PythonClient from pre-compiled version 0.8.4
using this:
"pip2 install -e . --user --upgrade"
https://github.com/carla-simulator/carla/tree/master/carla_ros_bridge
After uninstall it "pip uninstall carla"
now my
"python example.py" cmd won't find the incorrect version of carla.
And when I dol
python -c 'import carla; print carla'it's pointing to somewhere
~/carla/pre-/CARLA_0.8.4/PythonClient/__init__.pycwhich is the wrong version.
Removing both of them (or one of them) fixed the issue.