pip install lxml – Permission denied

When using Python you mostly rely on pip to install necessary libraries. Recently I ran the following command on my Mac:

pip install lxml

The result was the following output:

error: could not create '/Library/Python/2.7/site-packages/lxml': Permission denied

Obviously, writing to the folder /Library/ is not possible for a normal user account. There are several possible options to overcome this problem.

  1. You can use the command sudo pip install lxml to install the package
  2. You can use the command STATIC_DEPS=true sudo pip install lxml to install the package. This will download libxml2 and libxslt and build the source distribution afterwards.
  3. You use virtualenv to install the package only locally in your current project directory. See here for a good tutorial of virtualenv.

From my perspective option 3 is the cleanest way to install and manage lxml.

Advertisements

Failed to bring availability group ‘[availability group name]’ online

Recently, I was installing a SQL Server Availability Group on two VMs to verify some open questions I had. And I am surprised that the installation went pretty smoothly. But when I tried to create the availability group I got the following error message.

Failed to bring availability group ‘<availability group name>’ online. The operation timed out. Verify that the local Windows Server Failover Clustering (WSFC) node is online. Then verify that the availability group resource exists in the WSFC cluster. If the problem persists, you might need to drop the availability group and create it again.    
 
The message seemed to be pretty precise and I started verifying my WSFC configuration but unfortunately I couldn’t find any mistakes there. After searching for a while I found the following support post: http://support.microsoft.com/kb/2847723 It describes exactly my problem and the only thing I had to do was executing the following script:
USE [master]
GO
CREATE LOGIN [NT AUTHORITY\SYSTEM] FROM WINDOWS WITH DEFAULT_DATABASE=[master]
GO
 
GRANT ALTER ANY AVAILABILITY GROUP TO [NT AUTHORITY\SYSTEM]
GO
GRANT CONNECT SQL TO [NT AUTHORITY\SYSTEM]
GO
GRANT VIEW SERVER STATE TO [NT AUTHORITY\SYSTEM]
GO
 
It fixed the problem and I was able to create my availability group without any problems.

Suppressing Code Analysis warnings in Entity Framework generated code

When using Entity Framework Database First it can happen that the code generated by the edmx file causes Code Analysis errors. This happens due to the fact that the t4-template misses the GeneratedCode attribute. It is pretty easy to modify the template to contain the necessary attributes.

Modify the context template

  1. Add using System.CodeDom.Compiler; at the right position in the using directives
  2. Add [GeneratedCode(“EntityModelCodeGenerator”, “4.0.0.0”)] above the class declaration line

Modify the template of the model classes

  1. Find EntityClassOpening and modify to the return a string starting with the GeneratedCode attribute
  2. Find <#=codeStringGenerator.UsingDirectives(inHeader: false)#> and add  below using System.CodeDom.Compiler;

External Content Type does not appear in External Content Type Picker

Today I was working on some data integration issues and was creating a BDC model. So as always, I created the model, added a finder method and modeled my entity. Then I deployed the solution and tried to creating an external list to test my finder method. So far so good, but when opening the External Content Type Picker the following error appeared: External Content Types are not available. Contact your system administrator.

ExternalContentTypeNotFound

What is that? Did my deployment fail? I opened the BCS service application to check if the model was correctly deployed. But it was there. My next idea was that something with the permissions was wrong, but everything was as usual.

So, what could be wrong?  After a few minutes of staring onto the BDC model, I discovered it. My model was simply missing the specific finder method. After adding it, the external content type appeared in the picker. So, lesson learned for today: always add finder and specific finder method before deploying the model.